Skip to content

Latest commit

 

History

History
61 lines (50 loc) · 1.96 KB

README.md

File metadata and controls

61 lines (50 loc) · 1.96 KB

Task Manager API

This is a task manager API created using Node.js, Express.js, and MongoDB.

Getting started

To get started with the application, you will need to have Node.js and MongoDB installed on your system.

  1. First, clone the repository and navigate to the project directory.
  2. git clone https://github.com/MuslimShah/taskManagerAPI.git 
    cd taskManagerAPI
  3. Then, install the necessary dependencies using npm:
  4. npm install
  5. You will also need to create a .env file in the project root directory and set the following environment variables:
  6.     PORT=3000
    MONGODB_URL=mongodb://localhost:27017/task-manager-api
    JWT_SECRET=your_jwt_secret_key
    

    Make sure to replace your_jwt_secret_key with your own secret key.

  7. Start the server by running:
  8. npm start

API routes

The following API routes are available:

  • GET /api/v1/tasks - Returns a list of all tasks.
  • POST /api/v1/tasks - Creates a new task.
  • GET /api/v1/tasks/:id - Returns a single task with the specified ID.
  • PATCH /api/v1/tasks/:id - Updates a task with the specified ID.
  • DELETE /api/v1/tasks/:id - Deletes a task with the specified ID.

Example requests

Here are some example requests:

Creating a new task

  POST /api/v1/tasks
Request body:
{
"title": "Task title",
"description": "Task description"
}

Updating a task

  PATCH /api/v1/tasks/:id
Request body:
{
"title": "New task title"
}

Conclusion

That's it! You now have a fully-functional task manager API built with Express.js. If you have any questions or issues, feel free to open an issue or pull request in the repository.