Todo Application
Given an
Create a table with the name
Todo Table
Column | Type |
---|---|
id | INTEGER |
todo | TEXT |
priority | TEXT |
status | TEXT |
and write APIs to perform operations on the table
- Replace the spaces in URL with %20.
- Possible values for priorityareHIGH,MEDIUM, andLOW.
- Possible values for statusareTO DO,IN PROGRESS, andDONE.
API 1
Path: /todos/
Method: GET
Scenario 1
- Sample API /todos/?status=TO%20DO
Description:
Returns a list of all todos whose status is 'TO DO'
Response
- Sample API
Scenario 2
- Sample API /todos/?priority=HIGH
Description:
Returns a list of all todos whose priority is 'HIGH'
Response
- Sample API
Scenario 3
- Sample API /todos/?priority=HIGH&status=IN%20PROGRESS
Description:
Returns a list of all todos whose priority is 'HIGH' and status is 'IN PROGRESS'
Response
- Sample API
Scenario 4
- Sample API /todos/?search_q=Play
Description:
Returns a list of all todos whose todo contains 'Play' text
Response
- Sample API
API 2
Path: /todos/:todoId/
Method: GET
Description:
Returns a specific todo based on the todo ID
Response
API 3
Path: /todos/
Method: POST
Description:
Create a todo in the todo table,
Request
Response
API 4
Path: /todos/:todoId/
Method: PUT
Description:
Updates the details of a specific todo based on the todo ID
Scenario 1
- Request { "status": "DONE" }
Response
- Request
Scenario 2
- Request { "priority": "HIGH" }
Response
- Request
Scenario 3
- Request { "todo": "Some task" }
Response
- Request
API 5
Path: /todos/:todoId/
Method: DELETE
Description:
Deletes a todo from the todo table based on the todo ID
Response
Use
Export the express instance using the default export syntax.
Use Common JS module syntax.