A set of locally defined mocks, mock packages, and jest
Docker environment with Redis, NSQ, MongoDB and example_jmt service. The main objective is to demonstrate the use of mocks (in packages or local) across various code layers, such as route layers (using express), service layers (using redis and NSQ), and model layers (using mongo/mongoose)
Note: service ports have been modified to avoid conflicts with other services running on your PC.
- Redis: Cache and in-memory data storage (port 16379)
- NSQ: Distributed messaging system
- nsqlookupd: port 14160 (TCP), 14161 (HTTP)
- nsqd: port 14150 (TCP), 14151 (HTTP)
- nsqadmin: port 14171 (web interface)
- MongoDB: NoSQL database (port 37017)
- User: admin
- Password: password
- Database: example_jmt_db
- example_jmt: Main application (port 13000)
cd compose
docker-compose up -dcd compose
docker-compose logs -f example_jmtcd compose
docker-compose downcd compose
docker-compose down -vcd compose
docker-compose up -d --build example_jmt- example_jmt Application: http://localhost:13000
- NSQ Admin: http://localhost:14171
- MongoDB: mongodb://admin:password@localhost:37017/example_jmt_db?authSource=admin
- Redis: localhost:16379
Application files are mounted as a volume, so code changes are automatically reflected (if using nodemon).
The docker-compose.yml and Dockerfile.dev are implemented in such a way that node_modules stays only inside the image, thus ensuring "isolation" between local environment configurations and those defined by the dockerfile.