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 an order processing backend service using Express and TypeScript. The service will be deployed in a Kubernetes cluster and sits behind a service mesh. It connects to a PostgreSQL database and a Redis cache.
Endpoints:
POST /api/orders -- create an order (fields: customerId, items array with productId and quantity)GET /api/orders/:id -- get order by IDGET /api/orders?customerId=X -- list orders for a customerPATCH /api/orders/:id/status -- update order status (pending, confirmed, shipped, delivered)Assume database and Redis connection modules already exist as db.ts (exports a pool with .query()) and cache.ts (exports a redis client with .get()/.set()/.ping()). You do NOT need to implement these -- just import and use them.
Produce:
src/app.ts -- Express application with middleware and route setupsrc/routes/orders.ts -- Order route handlerssrc/types.ts -- TypeScript interfaces for Order, OrderItempackage.json -- With dependenciesk8s/deployment.yaml -- Kubernetes Deployment manifest for this service