Backend API implementation to get weather forecast data which include current temperature and other extended information by taking zip code as an input
http://{host}:8080/weather/current?zipCode={zipCode}
http://localhost:8080/weather/current?zipCode=581202
Displays weather forecast for the given zip code
- Forecast should at least have current temperature
- Additional points for high/low temperature and/or extended forecast
Make sure that following prerequisites are complated from end user side
- Clone the project using
git clone - Go to the directory using cmd
cd WheatherForcast/weather-forecast - Excute maven build cmd
mvn clean install, As part of this build it runs unit tests and inetgrations tests and creates Uber excutable jar file. - Finally use java cmd
java -jar target/weather-forecast-1.0.0.jarto start the Application after executing the comd user should be able to see the output like below.
To Validate multiple use case we are using curl command in this command we call the API with zipcode as parameter.
-
curl 'http://localhost:8080/weather/current?zipCode=581202'when user executes this cmd he will see following o/p
when user executes same cmd with same input as above results will fetched from cache instead of calling actual remote API as below.

-
curl 'http://localhost:8080/weather/current?zipCode=76when user executes this cmd with invalid he will see following o/p with 404 not found message
-
curl 'http://localhost:8080/weather/current?zipCode=when user executes this cmd with empty zip code he will see following o/p with 400 bad request message
NOTE : In All above use cases we are using country code IN(India), user can change it to any country code to get corresponding country weather forecast data this can be enhanced by accepting one more parameter either as part of the end point or we can have separate property in the code to have this feature.