REST API Server using NodeJS and MongoDB

Teacher

M. Aswini Kumar

Category

Domain Courses

Course Attendees

Still no participant

Course Reviews

Still no reviews

Course Name : REST API Server using NodeJS and MongoDB

Code(Credit) : CUDM2515(0-3-1)

Course Description

This course focuses on building robust and scalable RESTful APIs using NodeJS and MongoDB. Students will explore the fundamentals of NodeJS, including its non-blocking I/O model and event-driven architecture, and learn to create REST APIs using ExpressJS. The course covers MongoDB integration with Mongoose ORM for data modeling and CRUD operations, along with advanced topics like authentication, authorization, pagination, and API documentation. Through hands-on labs and a capstone project, students will develop and deploy a fully functional REST API, such as a blog platform or inventory management system, using best practices and cloud platforms like Render, Heroku, or Vercel.

Course Objectives

  • Understand the core concepts of NodeJS, REST architecture, and non-blocking I/O for server-side development.
  • Master ExpressJS for creating RESTful APIs, including routing, middleware, and request/response handling.
  • Learn MongoDB and Mongoose ORM for NoSQL database integration, schema design, and CRUD operations.
  • Implement authentication and authorization using JSON Web Tokens (JWT) and secure API routes.
  • Apply advanced REST API features like pagination, filtering, file uploads, and rate-limiting.
  • Develop and deploy a fully functional REST API with proper documentation and cloud hosting.
  • Follow best practices for project organization, security, and API scalability.

Course Outcomes

  • CO1: Explain the principles of NodeJS, REST architecture, HTTP methods, and MongoDB NoSQL concepts. (Remembering, Understanding)
  • CO2: Develop RESTful APIs using ExpressJS, including routes for GET, POST, PUT, and DELETE operations. (Applying, Creating)
  • CO3: Integrate MongoDB with NodeJS using Mongoose for schema-based CRUD operations. (Applying, Analyzing)
  • CO4: Implement secure APIs with user authentication, JWT, and role-based authorization. (Applying, Creating)
  • CO5: Design and implement advanced API features like pagination, filtering, sorting, and file uploads. (Applying, Evaluating)
  • CO6: Document REST APIs using Swagger and handle error responses with appropriate status codes. (Creating, Evaluating)
  • CO7: Build and deploy a scalable, well-structured REST API project on a cloud platform like Render or Vercel. (Creating, Evaluating)

Module 1: Introduction to NodeJS & REST APIs

Theory:

  • Introduction to NodeJS (Non-blocking I/O, event loop, npm)
  • REST Architecture basics (CRUD, HTTP methods, status codes)
  • Understanding JSON and Postman

Practical:

  • Install NodeJS, npm, and setup a basic project
  • Write a simple NodeJS HTTP server
  • Test APIs using Postman

Module 2: ExpressJS – Building REST APIs

Theory:

  • What is ExpressJS?
  • Express middleware and routing
  • API request/response lifecycle

Practical:

  • Create an Express app
  • Define routes: GET, POST, PUT, DELETE
  • Use middleware for logging and JSON parsing

Module 3: MongoDB Integration

Theory:

  • NoSQL concepts & MongoDB overview
  • Introduction to Mongoose ORM
  • Schemas and Data Modeling

Practical:

  • Setup MongoDB (local/cloud)
  • Connect NodeJS with MongoDB using Mongoose
  • Create schemas and perform CRUD operations on MongoDB

Module 4: RESTful CRUD with Mongoose

Theory:

  • RESTful principles in depth
  • Designing endpoints for resources
  • Status codes and error handling best practices

Practical:

  • Develop full CRUD REST API for a resource (e.g., students, products)
  • Implement proper status codes and error responses
  • Validate input using Mongoose schema validations

Module 5: Authentication and Authorization

Theory:

  • JWT/ OAuth (JSON Web Tokens) and sessions
  • Role-based access control
  • Security best practices (e.g., environment variables)

Practical:

  • Implement user registration and login
  • Use JWT for secure routes
  • Protect routes using middleware

Module 6: Advanced REST API Features

Theory:

  • REST API versioning
  • Pagination, filtering, and sorting
  • File uploads and rate-limiting

Practical:

  • Add pagination/filtering to a resource
  • Implement file upload using Multer
  • Add request throttling using middleware

Module 7: Mini Project + Deployment

Theory:

  • REST API documentation using Swagger
  • Hosting APIs on Render/Heroku/Vercel
  • Project structure and best practices

Practical:

  • Build a mini project (e.g., Task Manager, Blog API)
  • Document API endpoints
  • Deploy the app on cloud

Project Ideas

Students must develop one of the following:

  • Student Attendance API
  • Blog Platform Backend
  • Inventory Management API
  • Online Quiz Platform API
  • Simple E-commerce Backend

Project Evaluation Criteria

  • API completeness
  • Use of authentication & MongoDB
  • Code quality & deployment

Recommended Textbooks and Resources

Textbooks:

  • "Node.js Design Patterns" (3rd Edition, 2020) by Mario Casciaro and Luciano Mammino
  • "Practical Node.js" (2nd Edition, 2018) by Azat Mardan
  • "MongoDB in Action" (2nd Edition, 2016) by Kyle Banker et al.
  • "RESTful Web API Design with Node.js 10" (3rd Edition, 2018) by Valentin Bojinov
  • "Web Development with Node and Express" (2nd Edition, 2019) by Ethan Brown

Online Resources:

Online Courses:

  • "Node.js, Express, MongoDB & More" by Jonas Schmedtmann (Udemy)
  • "The Complete Node.js Developer Course" by Andrew Mead (Udemy)
  • MongoDB University Courses: university.mongodb.com

Tools & Platforms:

CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PSO1 PSO2 PSO3
CO1 3 2 - 1 - 2 - 2 2 1
CO2 3 2 3 2 2 2 1 3 3 2
CO3 2 3 2 2 2 1 1 3 3 3
CO4 2 2 3 2 2 2 1 3 3 2
CO5 2 3 3 3 2 1 2 3 3 2
CO6 2 2 2 3 2 3 2 2 3 2
CO7 3 3 3 3 3 3 3 3 3 3

Session Plan

Module 1: Introduction to NodeJS & REST APIs

Practical (6 hours):

  • Install NodeJS, npm, and set up a basic project environment (2 hours).
  • Write a simple NodeJS HTTP server using the http module (2 hours).
  • Install and configure Postman; test basic GET/POST requests (2 hours).

Project:

  • Discuss project ideas (Student Attendance API, Blog Platform Backend, etc.).
  • Form groups and finalize project topics.

Materials:

Outcomes Covered: CO1 (Introduction to NodeJS and REST concepts)

Module 1: Introduction to NodeJS & REST APIs (continued)

Practical (6 hours):

  • Explore npm packages and project structure (2 hours).
  • Create a basic REST API with NodeJS (GET/POST endpoints) (2 hours).
  • Test APIs with Postman, focusing on JSON payloads and status codes (2 hours).

Project:

  • Define project requirements and create a basic project repository.

Outcomes Covered: CO1, CO2 (Basic REST API development)

Module 2: ExpressJS – Building REST APIs

Practical (6 hours):

  • Set up an ExpressJS application with basic routing (2 hours).
  • Implement GET and POST routes for a sample resource (e.g., users) (2 hours).
  • Add middleware for logging and JSON parsing (2 hours).

Project:

  • Design initial API endpoints for the chosen project.

Outcomes Covered: CO2 (ExpressJS routing and middleware)

Module 2: ExpressJS – Building REST APIs (continued)

Practical (6 hours):

  • Implement PUT and DELETE routes for the sample resource (2 hours).
  • Handle query parameters and route parameters (2 hours).
  • Test all routes with Postman, ensuring proper responses (2 hours).

Project:

  • Implement basic GET/POST routes for the project.

Outcomes Covered: CO2 (Complete RESTful routes)

Module 3: MongoDB Integration

Practical (6 hours):

  • Set up MongoDB locally or on MongoDB Atlas (2 hours).
  • Connect NodeJS to MongoDB using Mongoose (2 hours).
  • Create a basic Mongoose schema for a resource (e.g., students) (2 hours).

Project:

  • Define MongoDB schemas for the project’s resources.

Outcomes Covered: CO3 (MongoDB and Mongoose setup)

Module 3: MongoDB Integration (continued)

Practical (6 hours):

  • Perform basic CRUD operations using Mongoose (2 hours).
  • Test MongoDB CRUD operations via Express routes (2 hours).
  • Handle MongoDB connection errors and async/await (2 hours).

Project:

  • Integrate MongoDB with project routes for basic CRUD.

Outcomes Covered: CO3 (MongoDB CRUD operations)

Module 4: RESTful CRUD with Mongoose

Practical (6 hours):

  • Develop a full CRUD API for a resource (e.g., products) (3 hours).
  • Implement input validation using Mongoose schemas (2 hours).
  • Add proper status codes and error responses (1 hour).

Project:

  • Implement CRUD endpoints for one project resource.

Outcomes Covered: CO2, CO3 (Full CRUD API)

Module 4: RESTful CRUD with Mongoose (continued)

Practical (6 hours):

  • Enhance CRUD API with query-based filtering (2 hours).
  • Implement error handling middleware for consistent responses (2 hours).
  • Test API robustness with edge cases in Postman (2 hours).

Project:

  • Add error handling and validation to project CRUD endpoints.

Outcomes Covered: CO2, CO3 (Advanced CRUD and error handling)

Midterm Preparation and Review

Practical (6 hours):

  • Review NodeJS, ExpressJS, and MongoDB concepts (2 hours).
  • Practice building a small REST API from scratch (3 hours).
  • Q&A and troubleshooting session for practical issues (1 hour).

Project:

  • Midterm project progress review and feedback.

Outcomes Covered: CO1, CO2, CO3

Note: Midterm examinations start on August 25, 2025.

Module 5: Authentication and Authorization

Practical (6 hours):

  • Implement user registration and login with bcrypt (2 hours).
  • Generate and verify JWT for authentication (2 hours).
  • Protect routes using JWT middleware (2 hours).

Project:

  • Add user authentication to the project.

Outcomes Covered: CO4 (JWT-based authentication)

Module 5: Authentication and Authorization (continued)

Practical (6 hours):

  • Implement role-based authorization (e.g., admin vs. user) (2 hours).
  • Secure sensitive routes with middleware (2 hours).
  • Use environment variables for sensitive data (2 hours).

Project:

  • Add role-based access control to project routes.

Outcomes Covered: CO4 (Authorization and security)

Module 6: Advanced REST API Features

Practical (6 hours):

  • Implement pagination for resource endpoints (2 hours).
  • Add filtering and sorting capabilities (2 hours).
  • Test advanced features with Postman (2 hours).

Project:

  • Integrate pagination and filtering into project APIs.

Outcomes Covered: CO5 (Pagination and filtering)

Module 6: Advanced REST API Features (continued)

Practical (6 hours):

  • Implement file uploads using Multer (2 hours).
  • Add rate-limiting middleware for API security (2 hours).
  • Test file upload and rate-limiting functionality (2 hours).

Project:

  • Add file upload or rate-limiting to the project as needed.

Outcomes Covered: CO5 (File uploads and rate-limiting)

Module 7: Mini Project + Deployment

Practical (6 hours):

  • Set up Swagger for API documentation (2 hours).
  • Prepare project for deployment (e.g., environment setup) (2 hours).
  • Deploy API to Render, Heroku, or Vercel (2 hours).

Project:

  • Finalize project API endpoints and documentation.

Outcomes Covered: CO6, CO7 (API documentation and deployment)

Module 7: Mini Project + Deployment (continued)

Practical (6 hours):

  • Test deployed API for functionality and performance (2 hours).
  • Optimize project structure and code quality (2 hours).
  • Finalize Swagger documentation and error handling (2 hours).

Project:

  • Complete project implementation and prepare for evaluation.

Outcomes Covered: CO6, CO7 (Project completion and optimization)

Project Evaluation and Wrap-Up

Practical (6 hours):

  • Conduct project presentations and API demos (3 hours).
  • Evaluate code quality, deployment, and documentation (2 hours).
  • Course review and feedback session (1 hour).

Project:

  • Final project submission

Outcomes Covered: CO7 (Project evaluation)

Our Main Teachers

M. Aswini Kumar

Assistant Professor
VIEW PROFILE