A simple, lightweight Todo application built with Go and MySQL, designed to demonstrate web development fundamentals and RESTful API design.
- Create new todo items
- Read all todos
- Read a specific todo by ID
- Update existing todos
- Delete todos
- Persistent storage with MySQL
- Go (version 1.20+)
- MySQL (version 8.0+)
- Postman (optional, for API testing)
- Backend: Go (Golang)
- Database: MySQL
- Architecture: RESTful API, MVC Pattern
go-learning/
│
├── config/
│ └── db.go # Database configuration
│
├── controllers/
│ └── todo_controller.go # HTTP request handlers
│
├── models/
│ └── todo.go # Data structures
│
├── main.go # Application entry point
├── schema.sql # Database schema
└── go.mod # Dependency management
- Install MySQL
- Create the database:
mysql -u root -p < schema.sql
go mod tidygo run main.goPOST /todos: Create a new todoGET /todos: List all todosGET /todo?id=X: Get a specific todoPUT /todos?id=X: Update a todoDELETE /todos?id=X: Delete a todo
{
"title": "Learn Go Programming",
"description": "Study Go fundamentals and build projects",
"completed": false
}Use the included Postman collection (Todo_App.postman_collection.json) to test the API.
Update database credentials in config/db.go
- Add user authentication
- Implement input validation
- Create more robust error handling
- Add logging
- Implement database migrations
MIT License
Ansar Ali Sarkar