An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# E Corp Node.js demonstration applications

[![CI](https://github.com/devpro/ecorp-nodejs-demo/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/devpro/ecorp-nodejs-demo/actions/workflows/ci.yml)
[![PKG](https://github.com/devpro/ecorp-nodejs-demo/actions/workflows/pkg.yml/badge.svg?branch=main)](https://github.com/devpro/ecorp-nodejs-demo/actions/workflows/pkg.yml)
[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/devprofr/ecorp-nodejsdemo-api?label=Docker)](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)