A REST API for order management with background processing, built with Go and MSSQL.
- REST API:
- Create orders with items
- Get order details
- List all orders
- Background Processing:
- Automatic status transitions:
Created→Processing→Completed - Each transition takes 5 seconds
- Automatic status transitions:
- Database:
- MSSQL storage
- Automatic table creation
- Production-Ready:
- Graceful shutdown
- Health checks
- Structured logging
| Method | Endpoint | Description |
|---|---|---|
| POST | /orders |
Create new order |
| GET | /orders/{id} |
Get order by ID |
| GET | /orders |
List all orders |
| GET | /health |
System health check |
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ API Layer │ → │ Service │ → │ Repository │ → │ MSSQL DB │
└─────────────┘ │ (Business │ │ (Data Access│ └─────────────┘
│ Logic) │ │ Layer) │
└─────────────┘ └─────────────┘
- Go 1.21+
- MSSQL Server 2019+
- Docker (optional)
docker-compose up --build -dDB_SERVER=db
DB_USERID=sa
DB_PASSWORD=YourStrong!Passw0rd
DB_DATABASE=master# Start locally
go run .We implemented:
- ✔️ REST API for order management
- ✔️ Background order processing
- ✔️ MSSQL database integration
- ✔️ Graceful shutdown
- ✔️ Health check endpoint
- ✔️ Structured logging to file