Every external call needs a timeout, every timeout needs a fallback — resilience patterns for HTTP, databases, and third-party services
88
90%
Does it follow best practices?
Impact
85%
4.72xAverage score across 5 eval scenarios
Passed
No known issues
Build a Node.js Express API endpoint that enriches order data by combining information from multiple internal microservices.
GET /api/orders/:orderId/detailsGiven an order ID, fetch and combine data from:
https://orders.internal.example.com/api/orders/:orderId) -- returns the base order: items, quantities, timestamps, customer ID.https://shipping.internal.example.com/api/shipments?orderId=:orderId) -- returns tracking number, carrier, estimated delivery date, current status.https://payments.internal.example.com/api/payments?orderId=:orderId) -- returns payment method, amount charged, payment status, transaction ID.https://inventory.internal.example.com/api/stock/check) -- POST with item IDs from the order to get current stock levels for each item.Return a combined response:
{
"order": {
"id": "order-456",
"items": [{ "productId": "prod-1", "quantity": 2, "price": 29.99 }],
"customerId": "cust-789",
"createdAt": "2025-03-15T10:30:00Z"
},
"shipping": {
"trackingNumber": "1Z999AA10123456784",
"carrier": "UPS",
"estimatedDelivery": "2025-03-20",
"status": "in_transit"
},
"payment": {
"method": "visa_ending_4242",
"amount": 59.98,
"status": "captured",
"transactionId": "txn-abc123"
},
"inventory": [
{ "productId": "prod-1", "inStock": 145 }
]
}The order service data is required -- if it fails, return a 404 or 500. The other three services (shipping, payment, inventory) provide supplementary data.
Authentication: all services use mTLS, no additional auth headers needed.
Produce TypeScript files in a src/ directory:
src/index.ts -- Express server with the enrichment routesrc/services/orders.ts -- fetches base order datasrc/services/shipping.ts -- fetches shipping statussrc/services/payments.ts -- fetches payment detailssrc/services/inventory.ts -- checks stock levelsDo not include test files or build configuration.