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 GET /api/dashboard that returns a combined dashboard summary. The endpoint should:
https://api.openweathermap.org/data/2.5/weather) for a city provided as a query parameter.https://www.alphavantage.co/query) for a list of stock symbols: AAPL, GOOGL, MSFT.https://newsapi.org/v2/top-headlines) for the "technology" category.Combine the results into a single JSON response:
{
"weather": { "city": "London", "temperature": 15, "conditions": "cloudy" },
"stocks": [
{ "symbol": "AAPL", "price": 178.50 },
{ "symbol": "GOOGL", "price": 141.20 },
{ "symbol": "MSFT", "price": 378.90 }
],
"news": [
{ "title": "...", "source": "..." }
]
}API keys are provided via environment variables: OPENWEATHER_API_KEY, ALPHA_VANTAGE_API_KEY, NEWS_API_KEY.
Produce TypeScript files in a src/ directory:
src/index.ts -- Express server setup with the dashboard routesrc/services/weather.ts -- function to fetch weather datasrc/services/stocks.ts -- function to fetch stock pricessrc/services/news.ts -- function to fetch news headlinesDo not include test files or build configuration.