Simple Go REST API for managing todos with Postgres.
- Copy env template:
cp .env.example .env - Start services:
docker compose up --build - Run the smoke test:
./test-api.sh
- All success responses use an envelope:
{ "message": "...", "data": ... }. - List endpoint supports pagination:
GET /api/todos?limit=20&offset=0.
List todos:
{
"message": "Todos retrieved successfully",
"data": {
"items": [
{
"id": 1,
"title": "Test Todo",
"description": "Example",
"completed": false,
"created_at": "2026-01-23T16:30:46Z",
"updated_at": "2026-01-23T16:30:46Z"
}
],
"pagination": {
"limit": 20,
"offset": 0,
"total": 1
}
}
}Get single todo:
{
"message": "Todo retrieved successfully",
"data": {
"id": 1,
"title": "Test Todo",
"description": "Example",
"completed": false,
"created_at": "2026-01-23T16:30:46Z",
"updated_at": "2026-01-23T16:30:46Z"
}
}