Skip to content

Haripriya-Sundaram/weatherforecast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Forecast App

Provide a website which will return the current weather data for a city selected by the user, it should support London and Hong Kong. To fetch the weather data this app will use OpenWeatherMap.org API service.

Overview

The site will display:

  • Today's date
  • City name
  • Overall description of weather (i.e.: "Light rain", "Clear sky", etc)
  • Temperature in Fahrenheit and Celsius
  • Sunrise and sunset times in 12 hour format (i.e.: 7:35am; 7:23pm)

Implementation

Work plan

  1. Create the base project files with Maven configuration and a simple Spring Boot app exposing a Welcome page
  2. Add a Rest Controller that will return the weather data for a given city
  3. Create an OpenWeatherMap API client and connect it to the Weather controller. It will require logic to map the response from OWM to the Weather view object.
  4. Add caching to reduce the calls to OWM service, there are recommendations about the data update frequency.
  5. The Forecast app will provide a regular HTML page return to render the Weather data and also a REST kind endpoint to get the data in JSON format.

Configurations

Maven 3

To make sure this project can be built with Maven 3.3, I setup the Maven Wrapper tool to use Maven 3.3.9 (latest 3.3 release)

The command to do that is

>$ mvn -N io.takari:maven:wrapper -Dmaven=3.3.9

Ref to tool: https://github.com/takari/maven-wrapper

Java 8

To build and run this project, Java 8 is required.

Most of the current Operating System distributions have the Java JRE installed already.

Download it from the Official Java 8 site

Deploy and run

When started, the App will run by default with an embedded Tomcat server on port 8080. i.e. to access the app in your local environment, start the app and in your browser go to

http://localhost:8080

Development

From the project's root dir:

>$ ./mvnw spring-boot:run

Production

Build

>$ ./mvnw package

this will generate an api-0.0.1-SNAPSHOT.jar file in the ./target directory

Run

The packaged jar file can be copied to another directory or simply run from there with the following command

>$ java -jar target/api-0.0.1-SNAPSHOT.jar

Links

Versions and changes

This project follows Keep a Changelog and Semantic Versioning

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors