- Install dependencies:
go mod download- Start PostgreSQL:
docker run -d -p 5432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=admin \
-e POSTGRES_DB=postgres \
postgres:15-alpine- Run the application:
go run cmd/api/main.goGET /health- Health checkGET /tasks- Get all tasksPOST /tasks- Create new taskPOST /tasks/update- Update taskPOST /tasks/delete- Delete task
docker build -t task-api .
docker run -p 8080:8080 --env-file .env task-apimyapp/
├── cmd/api/ # Application entry point
├── internal/ # Private application code
│ ├── handlers/ # HTTP handlers
│ ├── middleware/ # HTTP middleware
│ ├── models/ # Data models
│ ├── repository/ # Database layer
│ └── service/ # Business logic
├── pkg/ # Public libraries
│ ├── database/ # Database utilities
│ └── response/ # HTTP response helpers
└── config/ # Configuration