A simple REST API for managing notes using Node.js, Express, and MongoDB.
- Install dependencies:
npm install
- Create
.env
file:
MONGODB_URI=your_mongodb_connection_string
PORT=3000
- Start the server:
npm start
Method | URL | Description |
---|---|---|
GET | /api/notes |
Get all notes |
POST | /api/notes |
Create a note |
PUT | /api/notes/:id |
Update a note |
DELETE | /api/notes/:id |
Delete a note |
POST /api/notes
{
"title": "My Note",
"content": "Note content here"
}
GET /api/notes
src/
βββ config/ # Database connection
βββ controllers/ # Business logic
βββ middleware/ # Rate limiting
βββ models/ # Data models
βββ routes/ # API routes
βββ server.js # Main server file
- Node.js
- Express.js
- MongoDB Atlas
- Postman (for testing)