https://github.com/devpro/ecorp-nodejs-demo
Node.js demonstration applications for E Corp fake company
https://github.com/devpro/ecorp-nodejs-demo
container nodejs
Last synced: 11 months ago
JSON representation
Node.js demonstration applications for E Corp fake company
- Host: GitHub
- URL: https://github.com/devpro/ecorp-nodejs-demo
- Owner: devpro
- Created: 2022-12-26T13:56:22.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-27T13:57:30.000Z (about 3 years ago)
- Last Synced: 2025-01-11T04:31:25.153Z (about 1 year ago)
- Topics: container, nodejs
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# E Corp Node.js demonstration applications
[](https://github.com/devpro/ecorp-nodejs-demo/actions/workflows/ci.yml)
[](https://github.com/devpro/ecorp-nodejs-demo/actions/workflows/pkg.yml)
[](https://hub.docker.com/r/devprofr/ecorp-nodejsdemo-api)
## Local development
* Runs RabbitMQ in a container and check cluster status
```bash
docker run --name rabbitmq --rm --detach -p 5672:5672 -p 15672:15672 rabbitmq
docker exec rabbitmq rabbitmq-diagnostics cluster_status
```
* Makes sure RabbitMQ is running ok
```bash
./samples/send.js
docker exec rabbitmq rabbitmqctl list_queues
./samples/receive.js
```
* Installs dependencies (NPM packages)
```bash
npm install --dev
```
* Runs the application (test it with `curl http://localhost:3000/send`)
```bash
npm start
```
* Runs the application in a container (test it with `curl http://localhost:8080/send`)
```bash
docker build . -t ecorp-nodejs-demo
docker network create demo
docker network connect demo rabbitmq
docker run --name ecorp-nodejs-demo --rm -p 8080:3000 --net=demo -e "RABBITMQ_URL=amqp://rabbitmq:5672" ecorp-nodejs-demo
```
* Cleans up
```bash
docker ps stop rabbitmq
docker network delete demo
```
## References
* [RabbitMQ Hello World tutorial](https://www.rabbitmq.com/tutorials/tutorial-one-javascript.html)