Creating simple Web UI¶
The UI was created using React JS and a Node JS proxy to the API. Here is a highlight of key files:
workshop/frontendDockerfile- Dockerfile for building and deploying web app.env- local file used to provide configuration values (e.g. url)package.json- required package dependenciesserver.js- NodeJS application codesrc- React JS application source code directoryApp.tsx- main application codeindex.tsx- application entry point
Running Web UI locally¶
Build Web UI¶
- Go to the frontend directory
-
Run
npm installto get required dependencies -
Run
npm run buildto build the React application
Run Web UI¶
-
Create
.envfile infrontenddirectory and provide the following required values:PORT- port where React app is runningREACT_APP_PROXY_URL- url to the Node JS proxy
-
On a separate terminal export the following required variables for NodeJS proxy application (note
API_URLwill be different if using Github Codespace, e.g.https://awesome-journey-65pj9v9pw52rrrx-5020.app.github.dev/chat):- From
workshop/frontenddirectory start the NodeJS proxy application usingnode server.js
- From
-
On a separate terminal start backend API using:
-
Navigate to browser on http://localhost:3001 or forwarded address (if using Github Codespace) and test the chat application.
