This is a simple RESTful API built using Node.js, Express, and MongoDB for managing notes.
- Create, read, update, and delete notes
- Notes contain a title, content, and timestamps for creation and last update
- Data validation for note creation and update
- IST timezone for timestamps
To run this API locally, follow these steps:
- Clone the repository:
git clone https://github.com/your-username/note-taking-api.git
- Install dependencies:
cd note-taking-api npm install npm i express, express-validator,mongodb,mongoose,dotenv
- Set up environment variables:
* Create a .env file based on .env.example. * Add your MongoDB URI as DB_URI in the .env file.
- Start the server:
node index.js
- Run test suites :
npm install jest supertest --save-dev npx jest
The API endpoints are as follows:
- GET /api/notes - Retrieve all notes
- GET /api/notes/:id - Retrieve a single note by ID
- POST /api/notes - Create a new note
- PUT /api/notes/:id - Update a note by ID
- DELETE /api/notes/:id - Delete a note by ID
For detailed API documentation, refer to API Documentation
- Node.js
- Express.js
- MongoDB
- Mongoose
- Jest (for testing)
- Supertest (for testing)
Sarthak Kumar
This project is licensed under the MIT License - see the LICENSE file for details.