Create an API with the following features:
- start consuming weather data with an optional city filter;
- stop consuming weather data;
- fetch already collected weather data points;
- see the collected temperature measurements in CloudWatch.
Use any tech stack you are most comfortable with, although NodeJS is preferred.
The weather data you will be consuming is provided by a mock weather service that is part of this repository. The service simulates real-time weather data streaming and is prepared specifically for this homework assignment.
To get the weather data call GET /weather-data. The data is streamed as a JSONL in the following format:
{"city": string, "temperature": float}
GET /weather-data also accepts a query parameter cities to only get the data for the specified cities. The parameter
value is a comma-separated case-insensitive list of city names.
The fastest way to test the service is with docker:
docker build -t weather-service https://github.com/carVertical/homework-backend.git
docker run --rm -p 3000:3000 weather-serviceOr as a less ephemeral approach with docker compose:
services:
weather-service:
build: https://github.com/carVertical/homework-backend.git
ports:
- "3000:3000"
environment:
ITEMS_PER_SECOND: 10000 # change this value to test different scenariosThen call the service:
curl --silent 'http://localhost:3000/weather-data'