A small web front-end built using ReactJS. It should query the Echo module for a passwords and Radix runtime information.
App.js is the entrypoint for the application, and a good place to start exploring WWW.
The variable useMockData
in App.js decide if WWW should mock data itself or pull data from Echo API. If this is set to false, you need to run Echo API on localhost:3001 (default).
TODO BEFORE WORKSHOP!! USE_MOCK_DATA and ECHO_API_URL should be environment variables
This project was bootstrapped with Create React App.
Locally the app runs on the web server provided through create-react-app, while in production we'll use a nginx web server.
In the project directory, you can run:
Installs all dependencies required to run application
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Run a vulnerability check on dependencies
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
The reactjs app will be built by nodejs and served by a nginx web server.
To build the image for the WWW app
docker build -t www .
Note: Nginx config used by www contains a redirect to reach the echo api. This route needs to be commented in/out, based on mockOff/mockOn. This needes to be done at build time. Nginx throws an error if not.
To run the WWW app in Docker
docker run -it --rm -p 3000:3000 www
(replace -it
with -d
to run in detached mode)
In this repository we've cheated and created a base.Dockerfile which is pushed to keaaa/www-workshop-base:latest
. The actual Dockerfile refer to this base image.
This is not best practise, but to limit the docker build time, and have a more smooth experience during this workshop. For real scenarios you should include the steps in base.Dockerfile in the Dockerfile, so these steps are done on each build.
Do not add new or update dependencies for this component, as it will fail during build.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.