-
Notifications
You must be signed in to change notification settings - Fork 0
kushaagrg/To-do-Backend
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is an express HTTP server in Node.js which will handle the logic of a todo
list app.
Each todo has a title and a description. The title is a string and the description is
a string.
Each todo also gets an unique autogenerated id every time it is created
The API endpoints are defined below,
1.GET /todos - Retrieve all todo items
Description: Returns a list of all todo items.
Response: 200 OK with an array of todo items in JSON format.
Example: GET http://localhost:3000/todos
2.GET /todos/:id - Retrieve a specific todo item by ID
Description: Returns a specific todo item identified by its ID.
Response: 200 OK with the todo item in JSON format if found, or 404 Not Found if
not found.
Example: GET http://localhost:3000/todos/123
3. POST /todos - Create a new todo item
Description: Creates a new todo item.
Request Body: JSON object representing the todo item.
Response: 201 Created with the ID of the created todo item in JSON format. eg: {id: 1}
Example: POST http://localhost:3000/todos
Request Body: { "title": "Buy groceries", "completed": false, description: "I should
buy groceries" }
4. PUT /todos/:id - Update an existing todo item by ID
Description: Updates an existing todo item identified by its ID.
Request Body: JSON object representing the updated todo item.
Response: 200 OK if the todo item was found and updated, or 404 Not Found if not
found.
Example: PUT http://localhost:3000/todos/123
Request Body: { "title": "Buy groceries", "completed": true }
5. DELETE /todos/:id - Delete a todo item by ID
Description: Deletes a todo item identified by its ID.
Response: 200 OK if the todo item was found and deleted, or 404 Not Found if not found.
Example: DELETE http://localhost:3000/todos/123
- For any other route not defined in the server returns 404
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published