This project provides a HTTP server for managing a todo list. You can perform CRUD operations (Create, Read, Update, Delete) on todo items. Developed using JavaScript/Node.js/Express.js.
To get this project up and running locally, follow these steps:
- Node.js
- npm (Node Package Manager)
- Postman or Hoppscotch (for API testing)
-
Clone the repository:
https://github.com/kshitijjan/http-todo-app.git
-
Navigate into the project directory:
cd http-todo-app
-
Install Express
npm i express
To start the server, run:
node http-todo-app.js
The server will start listening on port 3000 by default, make sure you are inside of http-todo-app directory.
- Description: Retrieves all todo items.
- Usage: Use this endpoint to fetch all tasks in the todo list.
- Example:
http://localhost:3000/todos
- Description: Retrieves a specific todo item by ID.
- Usage: Replace
:id
with the ID of the todo item you want to fetch. - Example:
http://localhost:3000/todos/id123
- Note: You will get the ID once you post a new task, to access any specific task replace /id123 with /newID (for eg: /id36c33f4f27751)
- Description: Creates a new todo item.
- Usage: Send a JSON object with
title
,completed
, anddescription
fields in the request body. - Example:
http://localhost:3000/todos { "title": "Complete Project", "completed": false, "description": "Finish the project documentation." }
- Description: Updates an existing todo item by ID.
- Usage: Replace
:id
with the ID of the todo item to update. Send a JSON object with fields you want to update (title
,completed
,description
) in the request body. - Example:
http://localhost:3000/todos/id123 { "title": "Updated Title", "completed": true }
- Description: Deletes a todo item by ID.
- Usage: Replace
:id
with the ID of the todo item to delete. - Example:
http://localhost:3000/todos/id123
- Open Postman or Hoppscotch.io.
- Set the request type (GET, POST, PUT, DELETE) and enter the endpoint URL (e.g.,
http://localhost:3000/todos
). - For POST and PUT requests, add JSON data in the request body.
- Click on "Send" to execute the request.
- View the response in the "Response" section below the request.
Feel free to contribute to this project by submitting pull requests or suggesting improvements. Please follow the.