The app showcases core structure of Express backend applications with custom decorators for route handling, data validation and interaction with MongoDB databases.
MongoDB cluster is required to run the application. Follow instructions at https://www.mongodb.com/cloud/atlas/register to obtain a free MongoDB Atlas database to test the app.
Once the cluster is created, press "Connect" on the Clusters dashboard to obtain connection parameters:

When prompted, select "Drivers" to view connection parameters to your cluster:

These connection parameters will be required for environment setup later.
-
Clone this repository:
git clone
-
Navigate to the folder containing the code:
cd <folder_name>
-
Install dependencies
npm i
-
Copy env file
cp .env.example .env
-
Set up the environment constants
SERVER_PORT=3000 SERVER_HOST="localhost" MONGO_USER="username to access your MongoDB Cluster" MONGO_PASSWORD="password to access your MongoDB Cluster" MONGO_URL="URL of your MongoDB Cluster" MONGO_APP_NAME="MongoDB Cluster name" -
Run the application:
nodemon
The app is designed for interaction over HTTP. Any tool for API testing is compatible with the app. Postman is reccommended.
OPTIONS request with any path responds with a list of supported request options
GET /books/get/all - Responds with a list of books currently stored in MongoDB
GET /books/get/:id - If a document with id parameter is present, returns a Book object with matching ID
POST /books/create - creates a Book object in MongoDB with specified content. Request body is required:
{
"title": "BookTitle", // { type: String, required: true, unique: true },
"author": "BookAuthor" // { type: String, required: true },
}POST /books/query - Returns a list of Book objects currently stored in MongoDB matching specified filters. Filters are specified in request
body:
{
"title": "BookTitle", // { type: String, required: false },
"author": "BookAuthor" // { type: String, required: false },
}PUT /books/update/:id - If present, updates a Book object in MongoDB matching the id parameter with content specified in request body:
{
"title": "BookTitle", // { type: String, required: true, unique: true },
"author": "BookAuthor" // { type: String, required: true },
}DELETE /books/delete/:id - If present, deletes a Book object from MongoDB matching the id parameter
This project is licensed under the BSD-3-Clause License - see the LICENSE for details
Created by Serhii Ovchar
© Extrawest, 2026