CRUD REST API for managing To-dos built using Expressjs framework and mongodb for data persistence.
- install Node.js v10 or above on system
- install mongodb on system and listen for connections on
localhost:27017
- run
npm install
- run
npm start
to run the code
- set environment variable
NODE_ENV=test
This will use the test database for testing the endpoints for CRUD operations - run
npm test
to run the tests and generate the coverage reports.
code coverage reports will be generated in thecoverage
folder.
- unset environment variable
NODE_ENV
to prevent API to use the test db after the tests are finished. - to make application listen on different port, set environment variable
PORT=<desired port number>
e.g.PORT=9000
.
Default is port 3000.