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.js
as web framework, andMongoose.js
as 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.js
and file transport and log rotation usingwinston-daily-rotate-file
. - Fully dockerized.
- Unit testing using
Mocha.js
as test runner,Chai.js
for assertions,Sinon.js
for stubbing/spying, andFaker.js
for generating fake data. - e2e testing using
Mocha.js
as test runner,supertest
to send HTTP requests, andMongoDB In-Memory Server
for 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.