Welcome to the MongoDB Assignment repository! This project demonstrates basic CRUD operations using Node.js, Express.js, and MongoDB as part of semester coursework.
The repository contains a single server application for managing user data.
mongodbAssignment/
βββ server_assign/ # π₯ User Management API
β βββ index.js
β βββ package.json
β βββ .gitignore
βββ README.md
| # | Folder | Project Name | Description | Port | Status |
|---|---|---|---|---|---|
| 1 | server_assign |
π₯ User Management API | RESTful API to manage user records with MongoDB | 3000 | β Completed |
A RESTful API for managing user data stored in MongoDB.
Tech Stack: Node.js Β· Express.js Β· MongoDB Β· Mongoose
Features:
- π List all users
- π Fetch a specific user by ID
- β Add a single user
- ββ Add multiple users
- βοΈ Update a user (PATCH)
- βοΈ Update a user (PUT)
- ποΈ Delete a user
API Endpoints:
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Basic health check |
GET |
/users |
Retrieve all users |
GET |
/user/:id |
Fetch a user by ID |
POST |
/adduser |
Add a single user |
POST |
/addusers |
Add multiple users |
PATCH |
/patch-user/:id |
Update a user partially |
PUT |
/put-user/:id |
Update a user fully |
DELETE |
/delete-user/:id |
Delete a user |
Sample User Schema:
_id: Numbername: Stringcity: Stringmembership: String
- Navigate to the
server_assignfolder. - Install dependencies:
npm install - Ensure MongoDB is running and update the connection string in
index.jsif needed. - Start the server:
npm startornode index.js
The server will run on port 3000 by default.
This project is for educational purposes only.
Developed with β€οΈ by Deepak Kumar