Một ứng dụng Todo đơn giản được xây dựng với Express.js và MongoDB, hỗ trợ đầy đủ CRUD operations và giao diện web responsive.
- ➕ Thêm todo mới với validation
- ✅ Đánh dấu hoàn thành/chưa hoàn thành
- ✏️ Chỉnh sửa nội dung todo
- 🗑️ Xóa todo với xác nhận
- 🔄 Làm mới danh sách
- 📱 Responsive design cho mobile và desktop
- 🇻🇳 Hỗ trợ tiếng Việt hoàn toàn
- Node.js (>= 16.0.0)
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM cho MongoDB
- HTML5/CSS3 - Giao diện
- JavaScript (ES6+) - Logic frontend
- Fetch API - Gọi REST API
git clone https://github.com/AndrewDoan01/todo-nodejs.git
cd todo-nodejsnpm install- Tạo tài khoản MongoDB Atlas hoặc cài đặt MongoDB local
- Cập nhật connection string trong
index.js
# Development mode với nodemon
npm run dev
# Production mode
npm start- Backend API: http://localhost:5000
- Frontend: Mở file
index.htmltrong trình duyệt
| Method | Endpoint | Mô tả |
|---|---|---|
GET |
/ |
Trang chính |
GET |
/todos |
Lấy tất cả todos |
POST |
/todos |
Tạo todo mới |
PUT |
/todos/:id |
Cập nhật todo |
DELETE |
/todos/:id |
Xóa todo |
GET /todos
Response: [
{
"_id": "507f1f77bcf86cd799439011",
"text": "Học Express.js",
"completed": false,
"createdAt": "2025-07-02T10:30:00.000Z",
"updatedAt": "2025-07-02T10:30:00.000Z"
}
]POST /todos
Content-Type: application/json
{
"text": "Hoàn thành dự án",
"completed": false
}Project sử dụng GitHub Actions để tự động hóa testing và deployment:
- Push vào branch
main - Pull Request vào branch
main
- Checkout code từ repository
- Setup Node.js (versions 22)
- Install dependencies với npm ci
- Run tests (npm test)
- Run linting (nếu có)
- Build application (nếu cần)
- Security audit với npm audit
- ✅ Build status hiển thị trên README
- 🔒 Security audit tự động
- 📊 Multi-version Node.js testing
# Chạy tests (hiện tại chưa có test cases)
npm test
# Chạy linting (hiện tại chưa có linter)
npm run lint
# Security audit
npm audittodo-nodejs/
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions workflow
├── index.js # Server backend (Express + MongoDB)
├── index.html # Frontend giao diện
├── test-font.html # File test font tiếng Việt
├── package.json # Dependencies và scripts
├── .gitignore # Git ignore rules
└── README.md # Documentation
npm run dev # Với nodemon auto-reloadnpm start # Node.js production modeTạo file .env (optional):
PORT=5000
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/- Fork repository
- Tạo feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Tạo Pull Request
- ✅ Code phải pass CI/CD pipeline
- ✅ Tuân thủ coding standards
- ✅ Thêm tests cho features mới
- ✅ Cập nhật documentation
Distributed under the MIT License. See LICENSE for more information.
AndrewDoan01
- GitHub: @AndrewDoan01
- Express.js team
- MongoDB team
- Mongoose ODM
- GitHub Actions
⭐ Star this repo if you find it helpful!