- Clone the repository to your local machine:
git clone https://github.com/Shreyasrana18/Assignment-Node.js.git
cd your-repo
- Install dependencies:
npm install
- Run the app in development mode:
npm run dev
This command will start the server, and you can access the API at http://localhost:5001.
To run tests:
npm test
API documentation for the endpoints is available on Postman.
- POST /api/auth/signup: Create a new user account.
- POST /api/auth/login: Log in to an existing user account and receive an access token.
- GET /api/notes: Get a list of all notes for the authenticated user.
- GET /api/notes/:id: Get a note by ID for the authenticated user.
- POST /api/notes: Create a new note for the authenticated user.
- PUT /api/notes/:id: Update an existing note by ID for the authenticated user.
- DELETE /api/notes/:id: Delete a note by ID for the authenticated user.
- POST /api/notes/:id/share: Share a note with another user for the authenticated user.
- GET /api/search?q=:query: Search for notes based on keywords for the authenticated user.
- Login: should login a user
- Get Notes: should get user notes
- Get Note: should get a specific note
- Create Note: should create a note
- Update Note: should update a note
- Share Note: should share a note with a valid user
- User Not Found: should fail to share a note with an invalid user
- Note Already Shared: should fail to share a note that is already shared
- Search Query: should search for a note
- Delete Note: should delete a note
- Unauthorized Deletion: should fail to delete a note without authorization
Framework used:
- Node.js
- Express.js
Testing Framework & Assertion library used
- Mocha
- Chai
Database used:
- MongoDB