This is a Javascript/React template, configured for quick development setup in Crafting Sandbox.
This template contains a single Ping component:
<React.StrictMode>
<Ping />
</React.StrictMode>This component consists of a form with a single input and a button.
Once form is submitted, a GET request is made to some backend server that exposes a /ping api. This Ping component then renders the api response data.
<code>
{JSON.stringify(
{
ping: pong.ping,
received_at: new Date(pong.received_at).toLocaleString(),
},
null,
2
)}
</code>To run the app, you can do:
PORT=3001 npm startThe following App Configuration was used to create this template:
endpoints:
- http:
routes:
- backend:
port: http
target: js-react
path_prefix: /
name: app
services:
- description: Javascript/React template
name: js-react
workspace:
checkouts:
- path: src/template-javascript-react
repo:
git: https://github.com/crafting-dev/template-javascript-react.git
packages:
- name: nodejs
version: ~16
ports:
- name: http
port: 3001
protocol: HTTP/TCP