I will repeat: no question is dumb. :)

Okay so the application actually handles the request to OpenWeather. Think of our application as a messenger, who receives a request from us, then forwards that request to OpenWeather, and finally, delivers the response to us.

If you see the code in OpenWeatherImpl class, our application constructs the URL like so.

...
...
client
.get()
.uri { builder: UriBuilder ->
builder.path("/weather")
.queryParam("id", cityId.cityId)
.queryParam("APPID", config.apiKey)
.build()
}
...
...

That results in /weather?id=<cityId>&APPID=<config.apiKey> with the base url defined in OpenWeatherConfig class, which is https://api.openweathermap.org/data/2.5.

So, from your postman, you should send the request to http://localhost:8080/api/current-weather, which is the route defined in our Route class.

@Bean
fun buildRoute() = router {
("/api" and accept(APPLICATION_JSON)).nest {
POST("/current-weather", weatherService::getCurrentWeather)
}
}

Does that make sense?

A passionate Software Engineer trying to leave a good legacy on earth

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store