the-redback / nodejs-ts-rabbitmq-example

Node rabbitmq example in typescript along with expressjs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nodejs-ts-rabbitmq-example

License GitHub Actions TypeScript Style Guide code size

Docker-Compose

docker-compose up --remove-orphans -d --scale consumer=5

Run RabbitMQ in docker

docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.9-management

To test

curl -X POST localhost:3000/login -H 'Content-Type: application/json' -d '{"username":"user","password":"my_password"}'
curl localhost:3000/send-msg'
curl -X POST localhost:3000/tasks -H 'Content-Type: application/json' -d '{"msg":"wait 3s....."}'

yarn or yarn install

Installs all the dependencies

yarn clean

Deletes the generated dist folder.

yarn build

Cleans the dist folder first and then generates all the files.

yarn start

Cleans, generates and then starts using node dist/index.js command

yarn start:dev

Runs the program using ts-node src, ie, it does not require to generate all the dist files

yarn start:w

Runs in watch mode using nodemon. Helpful for rapid development and testing.

yarn lint

Checks esLinter using google/gts library.

yarn fmt

Fixes linter errors using google/gts library.

yarn test

It first cleans dist, generates dist as part of pretest, and then runs test. After finishing running, it checks lint as posttest.

About

Node rabbitmq example in typescript along with expressjs.

License:Apache License 2.0


Languages

Language:TypeScript 76.4%Language:Dockerfile 21.7%Language:JavaScript 1.9%