Project-Reclass/toynet-react
How to get started with toynet-react
Last updated
Was this helpful?
How to get started with toynet-react
Last updated
Was this helpful?
Check out your new networking buddy
Because toynet
uses multiple services, docker-compose
was introduced to help start each services and connect them on local machines. Docker compose port maps each service running (e.g. frontend and backend). The frontend application when used in a docker container normally runs on port 80, however, docker-compose maps port 3000 of the local machine to port 80 on the container. For the backend, it normally exposes port 8000 in the container, because port 8000 is not a system port, the docker-compose just maps port 8000 to port 8000 on the local machine.
This port mapping is represented in the docker-compose as
backend -> 8000 frontend -> 3000
The below software is required in order to get setup to run toynet-react
.
Because there are two parts to toynet
there is a docker-compose that is useful to get started developing as a fast as possible.
To start
The docker-compose file can then be run in the background using
Before starting the frontend of toynet
you will need to install all the dependencies. This can be done using
After the docker-compose starts up you can start toynet-react
for development using
Testing pull requests can be done without cloning down or checking out the pull request on the local machine. Because toynet-react
uses docker-compose pull-requests can be previewed by just using the docker-compose file.
For Linux run
On Windows (Powershell) run
Edit the docker-compose.yml
file to include the GitHub PR id.
And then run
The master or default branch can be tested in much the same way that PR previews can be tested.
Edit the docker-compose.yml
file use master or the default branch instead of a PR id.
And then run
Some plugins that you might find helpful are
ESLint
React
VSCode Styled Components
In the project directory, you can run:
npm run style:fix
- Fixes any automatically fixable ESLint errors.
npm run style:check
- Checks and displays any ESLint errors.
npm run check-types
- Checks all typescript types to ensure correct typing.
npm run build
- 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!
Sammy Tran
Yi Yang
Scott Richardson
Git
Docker
Docker-Compose
Node.js and NPM
and navate to .
The PR app can then be previewed at
The app can then be accessed at .
npm run start
- Runs the app in the development mode. Open to view it in the browser. The page will reload if you make edits. You will also see any lint errors in the console.
npm test
- Launches the test runner in the interactive watch mode. See the section about for more information.
See the section about for more information.
You can learn more in the . To learn React, check out the .