A simple HTTP-based web service built with Node.js and Express. The service allows users to add and view tasks through a basic web interface.
- Add new tasks
- View all tasks
- Simple and clean UI
- RESTful API endpoints
todo-app/
├── public/
│ └── index.html # Frontend UI
├── server.js # Node.js backend server
└── .gitignore # Ignored files for Git
- Clone the Repository
git clone https://github.com/your-username/nodejs-todo-app.git
cd nodejs-todo-app- Install Dependencies
npm install- Run the Server
node server.js- Open the App
Visit
http://localhost:3000in your browser.
- URL:
/api/tasks - Method:
POST - Body:
{
"task": "Your task description"
}- Response:
{
"id": 1,
"task": "Your task description"
}- URL:
/api/tasks - Method:
GET - Response:
[
{ "id": 1, "task": "Sample Task" },
{ "id": 2, "task": "Another Task" }
]- Add a Task
curl -X POST http://localhost:3000/api/tasks -H "Content-Type: application/json" -d '{"task":"Learn Node.js"}'- Get All Tasks
curl http://localhost:3000/api/tasks- Set the request type to
POSTorGET. - Use
http://localhost:3000/api/tasksas the URL. - For POST, set the body to raw JSON.
- Add delete task functionality.
- Implement task completion status.
- Add persistent storage (like MongoDB).
- Fork the repository.
- Create your feature branch (
git checkout -b feature-name). - Commit your changes (
git commit -m 'Add new feature'). - Push to the branch (
git push origin feature-name). - Open a Pull Request.
This project is licensed under the MIT License.
Feel free to contribute or suggest improvements! 🚀