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/frontend
Dockerfile
- 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 install
to get required dependencies -
Run
npm run build
to build the React application
Run Web UI¶
-
Create
.env
file infrontend
directory 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_URL
will be different if using Github Codespace, e.g.https://awesome-journey-65pj9v9pw52rrrx-5020.app.github.dev/chat
):- From
workshop/frontend
directory 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.