A professional-grade RESTful API for task management built with Go. This project demonstrates best practices in API design, error handling, and code organization.
- RESTful API endpoints for todo management
- Priority levels (high, medium, low)
- Status tracking (TO_BE_STARTED, IN_PROGRESS, COMPLETED)
- Search functionality
- Due dates and timestamps
- Input validation
- Error handling
- CORS support
- Logging middleware
- API documentation with Swagger
- Comprehensive test suite
- Go 1.22+
- Standard library for HTTP server
- UUID for unique identifiers
- VSCode REST Client for testing
- Clone the repository:
git clone https://github.com/yourusername/my-first-api.git
cd my-first-api- Install dependencies:
go mod tidy- Run the server:
go run cmd/api/main.goThe server will start on http://localhost:8080
Detailed API documentation is available in:
# Health Check
GET /health
# Todo Operations
GET /todo # Get all todos
POST /todo # Create a todo
PUT /todo/status # Update todo status
DELETE /todo # Delete a todo
# Filtering & Search
GET /todo/priority/{priority} # Get todos by priority
GET /todo/status/{status} # Get todos by status
GET /search?q={query} # Search todosUse the provided api.http file with VSCode REST Client to test all endpoints:
- Install REST Client extension in VSCode
- Open
api.http - Click "Send Request" above any request to test
my-first-api/
├── api.http # API test file
├── cmd/
│ └── api/
│ └── main.go # Application entry point
├── config/
│ └── config.go # Configuration management
├── internal/
│ ├── middleware/ # HTTP middleware
│ ├── models/ # Data models
│ ├── todo/ # Business logic
│ └── transport/ # HTTP handlers and routing
├── docs/ # Documentation
└── go.mod # Go modules file
- Database integration (PostgreSQL)
- User authentication
- Docker support
- CI/CD pipeline
- Rate limiting
- Caching layer
- Metrics and monitoring
Feel free to submit issues and enhancement requests!
This project is open-source and available under the MIT License.