A backend template based on:
- Express.js
- MongoDB
- Typescript
- Set environment variables for docker-compose. You can use .env in local.
MONGODB_URL=mongodb://IP_OR_DOMAIN:27017
MONGODB_USER=dbuser
MONGODB_PASSWORD=dbpassword
MONGODB_DBNAME=dbname
- docker compose up --build
Set environment variables.
- Install node_modules
npm i
- Create .env in the root directory
- Add the following variables:
MONGODB_URL=mongodb://localhost:27017
MONGODB_USER=dbuser
MONGODB_PASSWORD=dbpassword
MONGODB_DBNAME=dbname
PORT=4000
- Run
npm run start:watch
Create .env.test in the root directory with the following variables:
MONGODB_URL=mongodb://localhost:27017
MONGODB_USER=dbuser
MONGODB_PASSWORD=dbpassword
MONGODB_DBNAME=dbname
PORT=4000
Run once:
npm test
Run test watcher:
npm run test:watch