The app monitors weather forecasts for specific locations. If in the next five days the temperature exceeds a given lower limit, the system gives warnings in the REST API response. The app is integrated with two weather forecast services OpenWeatherMap and WeatherAPI.
- NestJS
- TypeScript
- MongoDB
- Docker
Application configuration such as mongodb uri, weather provider, weather provider API key and location of the config file is defined in the file .env
Frequency (milliseconds), the list of locations (cities), and lower temperature limits to monitor are defined in a separate file settings.json
- Clone repository
$ git clone https://github.com/sergeevyi/weather-monitoring-api
- Switch to the repo folder
cd weather-monitoring-api
-
Populate the required parameters in .env and settings.json files
-
There is a docker-compose.yml file for starting MongoDB and App with Docker.
$ docker-compose up -d
- Test with Swagger
REST API documentation is available on URL:
- Getting with Curl Weather warnings
$ curl -H 'content-type: application/json' -v -X GET http://localhost:3000/api/v1/weather
- After running, you can stop the Docker containers with
$ docker-compose down
docker-compose -f docker-compose-tests.yml up
or on the local machine
# unit tests
$ yarn run test