Skip to content

CRUD project to serve as example for future projects that use the same libraries. This repo has tests using the JEST framework and the mongoDB database (the tests also use mongoDB, but in memory using the mongodb-memory-server library).

Notifications You must be signed in to change notification settings

pedrobotolli/jest-mongodb-node-example

Repository files navigation

jest-mongodb-node-example

CRUD project to serve as an example for future projects that use the same libraries. This repo has some tests using the JEST framework and the mongoDB database (the tests also use mongoDB, but in memory using the mongodb-memory-server library).

To run this project on your machine you need to create a .env file in the root folder with this content:
PORT=< PORT (e.g. 3001) >
DB_URI=< your mongoDB URI >

To run this project using docker you need to run the following commands in your terminal:
docker build . -t jest-mongodb-node-example
docker run --env PORT=< CONTAINER PORT (e.g. 3001) > --env DB_URI=< your mongoDB URI > -p < LOCALHOST PORT (e.g. 3001) >:< CONTAINER PORT (e.g. 3001) > -d jest-mongodb-node-example

To add your app to a Kubernetes cluster you need to create a .env file (described above) and run the following commands in your terminal:
kubectl create secret generic jest-mongodb-node-secrets --from-env-file=.env
kubectl apply -f deployment.yml

(Remember to add your worker nodes ips to the mongoDB whitelist)

About

CRUD project to serve as example for future projects that use the same libraries. This repo has tests using the JEST framework and the mongoDB database (the tests also use mongoDB, but in memory using the mongodb-memory-server library).

Resources

Stars

Watchers

Forks

Packages

No packages published