CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/graceful-degradation

Every external call needs a timeout, every timeout needs a fallback — resilience patterns for HTTP, databases, and third-party services

88

4.72x
Quality

90%

Does it follow best practices?

Impact

85%

4.72x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-5/

Weather and Stocks Dashboard API

Build a Node.js Express API endpoint GET /api/dashboard that returns a combined dashboard summary. The endpoint should:

  1. Fetch current weather data from the OpenWeatherMap API (https://api.openweathermap.org/data/2.5/weather) for a city provided as a query parameter.
  2. Fetch stock price data from Alpha Vantage (https://www.alphavantage.co/query) for a list of stock symbols: AAPL, GOOGL, MSFT.
  3. Fetch top headlines from NewsAPI (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.

Output

Produce TypeScript files in a src/ directory:

  • src/index.ts -- Express server setup with the dashboard route
  • src/services/weather.ts -- function to fetch weather data
  • src/services/stocks.ts -- function to fetch stock prices
  • src/services/news.ts -- function to fetch news headlines

Do not include test files or build configuration.

evals

tile.json