A robust, production-ready Notes Management API built with the MERN stack (Node, Express, MongoDB). This API follows professional RESTful standards, implementing full CRUD operations, bulk actions, and clean MVC architecture.
- ✅ Full CRUD: Create, Read, Update, and Delete notes with ease.
- 🚀 Bulk Operations: Create and delete multiple notes in a single request for high efficiency.
- 🔍 Strict Validation: Input validation for ObjectIds and required fields ensuring data integrity.
- 🏗️ MVC Architecture: Clean separation of concerns between Models, Controllers, and Routes.
- 🛠️ RESTful Standards: Proper use of HTTP methods (
GET,POST,PUT,PATCH,DELETE). - 📝 Automatic Timestamps: Tracking when notes are created and last updated.
- Core: Node.js, Express.js
- Database: MongoDB via Mongoose ODM
- Environment: dotenv for secure configuration
- Development: Nodemon for seamless DX
notes-app/
├── src/
│ ├── config/ # Database connection logic
│ ├── controllers/ # Business logic & request handling
│ ├── models/ # Mongoose schemas & data validation
│ ├── routes/ # API endpoint definitions
│ ├── app.js # Express app configuration
│ └── index.js # Server entry point
├── .env.example # Template for environment variables
├── package.json # Project manifests & scripts
└── README.md # Documentation
# Clone the repository
git clone https://github.com/priyabratasahoo780/Assignment1_NodeJs.git
# Move into project directory
cd Assignment1_NodeJs
# Install dependencies
npm installCreate a .env file in the root directory:
MONGO_URI=mongodb://127.0.0.1:27017/notes-db
PORT=5000# Start development server with Nodemon
npm run dev
# Start production server
npm start| Method | Endpoint | Description |
|---|---|---|
| GET | /api/notes |
Fetch all notes (Sorted by newest first) |
| GET | /api/notes/:id |
Fetch a single note by its unique ID |
| POST | /api/notes |
Create a new note |
| POST | /api/notes/bulk |
Create multiple notes at once |
| PUT | /api/notes/:id |
Replace an entire note (All fields required) |
| PATCH | /api/notes/:id |
Update specific fields of a note |
| DELETE | /api/notes/:id |
Delete a single note |
| DELETE | /api/notes/bulk |
Delete multiple notes using an array of IDs |
Endpoint: /api/notes
Body:
{
"title": "Project Meeting",
"content": "Discuss API documentation on Friday.",
"category": "work",
"isPinned": true
}{
"success": true,
"message": "Note created successfully",
"data": { ... }
}This API implements the semantic difference between these two methods:
- PUT: Used for Replacement. Requires the full object. If fields are missing, they will be overwritten/reset.
- PATCH: Used for Partial Updates. Only the fields sent in the body will be modified.
Priyabrata Sahoo
- 🌍 GitHub: @priyabratasahoo780
- 🚀 Live Backend: https://assignment1-nodejs-nl6x.onrender.com
- 📝 GitHub Repository: https://github.com/priyabratasahoo780/Assignment1_NodeJs
If you like this project, please give it a ⭐ on GitHub!