Created by Fabricio Braga
Last update: Tue 1 Apr 2025
This is a reference base project for students of Hack the Gap company, Course 6: Developing Back-End Apps with Node.js and Express. It provides a foundation for building a To-Do List API with Node.js HTTP server, demonstrating:
- Basic server setup
- REST API principles
- In-memory data management
- Modular code organization
- Request handling
- CRUD operations for todo items
- JSON API responses
- Error handling
- Sample data seeding
- Clean code structure
todo-list-api/
├── models/
│ └── TodoList.js # TodoList class implementation
├── server.js # Main server file
├── .gitignore # Git ignore rules
└── README.md # This file
- Node.js 18.x or higher
- npm or yarn
-
Clone the repository:
git clone https://github.com/hackthegap/base-todo-list.git cd base-todo-list
-
Install dependencies:
npm install
-
Start the server:
npm start
The server will start on
http://localhost:3000
Method | Endpoint | Description |
---|---|---|
GET | /todos | Get all todo items |
GET | /todos/:id | Get a specific todo item |
POST | /todos | Create a new todo item |
Get all todos:
curl http://localhost:3000/todos
Get specific todo:
curl http://localhost:3000/todos/1
Create new todo:
curl -X POST -H "Content-Type: application/json" -d '{"task":"Learn Express"}' http://localhost:3000/todos
- Implement the remaining CRUD operations (PUT/PATCH, DELETE)
- Add data persistence (file system or database)
- Implement Express.js version
- Add input validation
- Create frontend interface
Happy Coding! 🚀