$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Container name can be one of: redis | rabbit | lorem | math | human | hello
$ docker stop <container name>
$ docker rm <container name>
$ docker build -f .\app.Dockerfile -t <your name>/hello-microservice .
$ docker build -f .\human-generator.Dockerfile -t <your name>/human-generator .
$ docker build -f .\lorem-ipsum-world.Dockerfile -t <your name>/lorem-ipsum-world .
$ docker build -f .\math-world.Dockerfile -t <your name>/math-world .
$ docker network create hello
NOTE: Pull Redis and RabbitMQ images to local docker pull redis
and docker pull rabbitmq
if you don't.
$ docker run -itd -p 6379:6379 --network hello --name redis -h redis redis
$ docker run -itd -p 5672:5672 --network hello --name rabbit -h rabbit rabbitmq
NOTE: All microservices are using .dev.env
and corresponding to redis/rabbit/math docker container names
$ docker run --network hello -itd --name human -h human <your name>/human-generator
$ docker run --network hello -itd --name lorem -h lorem <your name>/lorem-ipsum-world
$ docker run --network hello -itd --name math -p 9001:9001 -h math <your name>/math-world
$ docker run --network hello -itd --name hello -p 3000:3000 -h hello <your name>/hello-microservice
5. The last thing is go to http://localhost:3000
Returns 404
:
curl -X GET http://localhost:3000
Returns 200
:
curl -X GET http://localhost:3000/lorem
Returns 200
:
curl -X GET http://localhost:3000/sum?numbers[]=1&numbers[]=2
Returns 200
:
curl -X GET http://localhost:3000/human