UI for sample distributed TODO application.
PORT
- a port the application binds toAUTH_API_ADDRESS
- address ofauth-api
for authenticationTODOS_API_ADDRESS
- address oftodos-api
for TODO CRUD
# install dependencies
npm install
# build application
npm run build
PORT=8080 AUTH_API_ADDRESS=http://127.0.0.1:8000 TODOS_API_ADDRESS=http://127.0.0.1:8082 npm start
Here you can find the software required to run this microservice, as well as the version we have tested.
Dependency | Version |
---|---|
Node | 8.17.0 |
NPM | 6.13.4 |
To run this application in docker you need to also initialize the other microservices, but first of all you need to create a network.
We need to have all the containers of the microservices in the same network, so they can interact with each other to create a network with docker you need to run in your terminal this command:
docker network create example
This will create a network called example in docker. To check the list of networks that are currently active you can run:
docker network ls
This is the final microservice you need to run You need to build the image of the application, so you need to create a Dockerfile in this folder, you can do it with:
touch Dockerfile
Now to build the application you need to run:
docker build --tag frontend .
Now to run the image of this microservice, you need to run this command:
docker run --rm --net example --name frontend -d \
-p 8080:8080 \
--env AUTH_API_ADDRESS=http://auth-api:8000 \
--env TODOS_API_ADDRESS=http://todos-api:8082 \
--env PORT=8080 \
frontend
In order, each line does:
- will add the image to the network | Give a name to the container | Run it in background
- The port that we will open to the world and in my local machine
- A environment variable
- A environment variable
- A environment variable
- The image that we are going to run
Here you can find the software required to run this microservice in docker, as well as the version we have tested.
Dependency | Version |
---|---|
Docker | 20.10.17 |