Health check and readiness endpoints for web services — liveness probes,
97
99%
Does it follow best practices?
Impact
94%
3.61xAverage score across 4 eval scenarios
Passed
No known issues
Build a product inventory microservice in Go using the standard library net/http router (Go 1.22+). The service will be deployed as a Docker container in a managed container platform with automatic scaling.
Endpoints:
GET /api/products -- list all productsPOST /api/products -- add a product (fields: name, sku, quantity, price)GET /api/products/{id} -- get product by IDPUT /api/products/{id} -- update product stock quantityDELETE /api/products/{id} -- remove a productUse SQLite via modernc.org/sqlite for persistence. SKU must be unique.
Produce:
main.go -- Application entry point, server setup, and routinghandlers.go -- HTTP handler functionsdb.go -- Database connection and queriesgo.mod -- Module definition with dependenciesDockerfile -- Multi-stage build for production