A simple, clean and fully functional Notes REST API built with Node.js, Express, and MongoDB (Mongoose).
Perfect for learning backend development or integrating into your full-stack projects.
Test all endpoints easily with Postman, Thunder Client, or any API client.
Frontend repo:
π https://github.com/Jerrwin/Node-Notes-Frontend.git
- Create a new note
- Get all notes
- Get a single note by ID
- Update a note (Partial update using PATCH)
- Delete a note
- Search notes by title (case-insensitive)
- Automatic
createdAt&updatedAttimestamps
- Node.js
- Express.js
- MongoDB
- Mongoose
- dotenv
project/
βββ controllers/
β βββ noteController.js
βββ models/
β βββ noteModel.js
βββ routes/
β βββ noteRoutes.js
βββ config/
β βββ db.js
βββ index.js
βββ .env
βββ package.json
- Clone the repository
git clone https://github.com/Jerrwin/Node-Notes-API.git cd Node-Notes-API - Install dependencies
npm install
- Create a .env file in the root directory
MONGO_URI=your_mongodb_connection_string_here PORT=5000
- Start the server
Server runs at β http://localhost:5000
npm run dev
| Method | Endpoint | Description |
|---|---|---|
POST |
/notes/add |
Create a new note |
GET |
/notes/getAll |
Get all notes |
GET |
/notes/search?title=xyz |
Search notes by title (case-insensitive) |
PATCH |
/notes/update/:id |
Update a note (partial update) |
DELETE |
/notes/delete/:id |
Delete a note |
Example Request (POST /notes)
{
"title": "My First Note",
"content": "This is important!",
"tags": ["work", "urgent"]
}Feel free to fork this repository and submit pull requests.
This project is beginner-friendly and open for improvements.