Backend for adding, listing, updating and deleting todos.
A todo item looks like this -
{
"_id": "60b09540c8a51f2904e9d945",
"title": "Get groceries",
"description": "Get groceries",
"completed": false,
"createdAt": "2021-05-28T07:01:20.904Z",
"updatedAt": "2021-05-28T07:01:20.904Z",
"__v": 0
}Features -
- Scalable web server using vanilla javascript,
Express.jsas web framework, andMongoose.jsas ODM. - Use of useful middlewares like
G-Zip compression,CORS,Helmet.js, andCorrelation Id. - Centralized Request body validation for HTTP POST and HTTP PUT requests using
JSON schema AJV. - Structured logging using
Winston.jsand file transport and log rotation usingwinston-daily-rotate-file. - Fully dockerized.
- Unit testing using
Mocha.jsas test runner,Chai.jsfor assertions,Sinon.jsfor stubbing/spying, andFaker.jsfor generating fake data. - e2e testing using
Mocha.jsas test runner,supertestto send HTTP requests, andMongoDB In-Memory Serverfor persistence during test runs. - HTML test coverage using
nyc.
NPM scripts -
npm install- to install dependencies.npm run start- to start web servernpm run dev- to start web server in dev mode using nodemonnpm run test- to run unit and e2e testsnpm run coverage- to generate test coverage
Docker -
docker compose up to start the web server with its dependencies.
Postman collection, collection public link, and environment variables here.