Technical test for a job interview.
Rust 100.0%
9 1 0

Clone this repository

https://tangled.org/me.vylion.com/weather-rust-service
git@knot1.tngl.vylion.com:me.vylion.com/weather-rust-service

For self-hosted knots, clone URLs may differ based on your setup.

README.md

Notes#

As for REST API enabling libraries, the one with the most readily available information was Rocket, and that was the main reason Rocket was chosen for this app. However, it requires the nightly verison of Rust and, currently, it has no capabilities for asynchronous functions to work as REST handlers, which is why the Client created in download.rs is blocking instead of asynchronous.

Ideas for improvement:

  • Adding actual testing. Note: Some tests added here.
  • Adding some permanence, so requests closer in time than 10 minutes use a local cache'd copy.
    • Either keeping the parameters of the last cache'd call too, to manually convert temperature units if the user asks for a different one, or change queries to always get them in Kelvin and always do the manual calculations when presenting the info to the user.
    • Defining our own Json Weather & Forecast structs in utils.rs to allow for more complex parsing.
  • Adding the alternative API calls available at OpenWeather.
  • Check that parameters are correct & compatible (city name with the country code, for example), using the resources from OpenWeather.
  • Reusing the Http Client across API calls.
  • Read the OpenWeather API key from parameters instead of hving it hardcoded.

Consulted Documentation#