/weather-app

Primary LanguageClojure

Weather app

It is a small web application that provides a simple API for requesting the current weather and stores these requests into a database. Weather data is collected from openweathermap.org.

API

Only one endpoint is available:

<host>/weather/{city}

Request example:

localhost:9999/weather/Paris

Response example:

{
  "city" : "Paris",
  "temperature" : 13.81,
  "datetime" : "2022-05-24T20:29:02Z"
}

Configuration (important)!!!

Before the run, you need to configure the app. The app gets parameters via environment variables. All parameters have default values except - api key for accessing openweathermap.org. Please open .env file and set it. You can also update some other options if necessary.

How to run

After configuration you are ready to launch app locally.

Launch database (it will take a little time):

make up

When database launched, run app:

make run

When you see Server is launching on port - congratulations! App is running :)

Note: app starts by default on port - 9999, database - on 5433

Useful commands

Some another commands from Makefile

For stopping database:

make down

For launching dev repl:

make repl

For accessing to database via psql:

make psql

Used tools, libs and keywords

  • Clojure
  • Postgres 14
  • Ring
  • Aero
  • Integrant
  • Reitit
  • JDBC
  • Hikari-CP
  • deps.edn
  • Makefile

Missing points

  • [ ] SQL library (Honey SQL / HugSQL)
  • [ ] Logging
  • [ ] Tests
  • [ ] Better error handling