Git Product home page Git Product logo

todo_api's Introduction

MongoDB-Node-Express To Do

A CRUD operation with MongoDB, Node, Express without mongoose

Getting Started

you need to edit .env file with your DB URL, replace YOUR_CONNECTION_URL with proper url once done, simple run

npm install
npm run server

API Usage and Endpoints for Task

Add a new task [POST /api/tasks]

  • Request: Add Task

    • Headers Content-Type: application/json

    • Body { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high" }

  • Response: 201 Created

Get all tasks [GET /api/tasks]

  • Request: Get all tasks

  • Response: 200 OK

    • Body [ { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high" } ]

Get a task [GET /api/tasks/:id]

  • Request: Get a task

  • Response: 200 OK

    • Body { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high" }

Update a task [PUT /api/tasks/:id]

  • Request: Update a task

    • Headers Content-Type: application/json

    • Body { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high" }

  • Response: 200 OK

Delete a task [DELETE /api/tasks/:id]

  • Request: Delete a task

  • Response: 200 OK

Mark task as done date [PUT api/tasks/markAsDone/:id]

  • Request: Mark task as done date

    • Headers Content-Type: application/json

    • Body { "doneDate": "23/09/2022" }

  • Response: 200 OK

Change task Status [PUT api/tasks/status/:id]

  • Request: Change task Status

    • Headers Content-Type: application/json

    • Body { "status": "pending" }

  • Response: 200 OK

Filter Task by status [GET api/tasks/status/:status]

  • Request: Filter Task by status

  • Response: 200 OK

    • Body [ { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high" } ]

Search Task by title [GET api/tasks/search/:title]

  • Request: Search Task by title

  • Response: 200 OK

    • Body [ { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high" } ]

Sort tasks by start date, due date, done date [GET api/tasks/sort]

  • Request: Sort tasks by start date, due date, done date

    • Headers Content-Type: application/json

    • Body { "dateType": "startDate", }

  • Response: 200 OK

API usage and Endpoints for Projects

Add a new project [POST /api/projects]

  • Request: Add Project

    • Headers Content-Type: application/json

    • Body { "title": "Project Title", "description": "Project Description", "startDate": "23/09/2022", "dueDate": "23/09/2022" }

  • Response: 201 Created

Get all projects [GET /api/projects]

  • Request: Get all projects

  • Response: 200 OK

    • Body [ { "title": "Project Title", "description": "Project Description", "startDate": "23/09/2022", "dueDate": "23/09/2022" } ]

Get a project [GET /api/projects/:id]

  • Request: Get a project

  • Response: 200 OK

    • Body { "title": "Project Title", "description": "Project Description", "startDate": "23/09/2022", "dueDate": "23/09/2022" }

Update a project [PUT /api/projects/:id]

  • Request: Update a project

    • Headers Content-Type: application/json

    • Body { "title": "Project Title", "description": "Project Description", "startDate": "23/09/2022", "dueDate": "23/09/2022" }

  • Response: 200 OK

Delete a project [DELETE /api/projects/:id]

  • Request: Delete a project

  • Response: 200 OK

Get all tasks of a project [GET /api/projects/:id/tasks/]

  • Request: Get all tasks of a project

  • Response: 200 OK

    • Body [ { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high", projectId: "5OM3R4ND0M1D" } ]

Assign Task to a Project [POST /api/projects/:id/tasks/]

  • Request: Assign Task to a Project

    • Headers Content-Type: application/json

    • Body { taskId: "5OM3R4ND0M1D" }

  • Response: 200 OK

Remove Task from a Project [DELETE /api/projects/:id/tasks/:taskId]

  • Request: Remove Task from a Project

  • Response: 200 OK

Filter Task by Project Name [GET /api/projects/:projectName/tasks]

  • Request: Filter Task by Project Name

  • Response: 200 OK

    • Body [ { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high", projectId: "5OM3R4ND0M1D" } ]

Sort Project by start date, due date [GET /api/projects/sort/:sortBy]

  • Request: Sort Project by start date, due date

    • Headers Content-Type: application/json

    • Body { "dateType": "startDate", }

  • Response: 200 OK

    • Body [ { "title": "Project Title", "description": "Project Description", "startDate": "23/09/2022", "dueDate": "23/09/2022" } ]

API usage and endpoints for aggregatiors

Get task by due date [POST /aggregators/tasks]

  • Request: Get task by due date

    • Headers Content-Type: application/json

    • Body { "dueDate": "23/09/2022" }

  • Response: 200 OK

    • Body [ { "title": "Task Title", "description": "Task Description", "startDate": "23/09/2022", "dueDate": "23/09/2022", "status": "pending", "priority": "high", projectId: "5OM3R4ND0M1D" } ]

Get project by due date [POST /aggregators/projects]

  • Request: Get project by due date

    • Headers Content-Type: application/json

    • Body { "dueDate": "23/09/2022" }

  • Response: 200 OK

    • Body [ { "title": "Project Title", "description": "Project Description", "startDate": "23/09/2022", "dueDate": "23/09/2022" } ]

todo_api's People

Contributors

kryptonbd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.