Skip to content

Shreyasrana18/Notes-API

Repository files navigation

ASSIGNMENT

How to Run the Node.js Project

  1. Clone the repository to your local machine:
git clone https://github.com/Shreyasrana18/Assignment-Node.js.git
cd your-repo
  1. Install dependencies:
npm install
  1. 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.

Testing

To run tests:

npm test

Postman Documentation

API documentation for the endpoints is available on Postman.

Postman Documentation Link

Authentication Endpoints

  • 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.

Note Endpoints

  • 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.

Testing Details

Notes Controller Tests

  • 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

Frameworks and Database Used

Framework used:

  • Node.js
  • Express.js

Testing Framework & Assertion library used

  • Mocha
  • Chai

Database used:

  • MongoDB

Contact

If you have any questions or suggestions, feel free to contact me at [email protected].

Happy coding!

About

Notes taking API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published