gade-raghav / Info-Weather

Info-Weather is a java application which uses Spring-boot framework to get weather information.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Info-Weather

Info-Weather is a java application which uses Spring-boot framework to get weather information.

Requirements

  • java (tested on openjdk 11.0.6)
  • spring-boot framework
  • node (v12.16.1)
  • npm (6.14.4)
  • docker(makes it easier)

Usage

Clone the repo

Set up an environment variable WEB_APPID and map it to APPID which you can get after signing up on openweathermap. Use this link in case there's an issue in setting up an environment variable.

run the following command on Linux CLI

cd info-weather
./mvnw spring-boot:run

alternatively you can build a jar package and run the jar file.

cd info-weather
./mvnw clean package     #to create jar package and remove the existing one
java -jar target/mavenreactjsspringboot-0.0.1-SNAPSHOT.jar

Proceed only if there are no errors after running the previous command.

GUI Interface

go to http://localhost:8080 and thats it !!

Terminal

  • Current Weather

You can make a curl request

curl "http://localhost:8080/weather/current?location={city name}"

You can enter the following url with required parameters in browser.

http://localhost:8080/weather/current?location={city name}
  • Forecast Weather

You can make a curl request

curl "http://localhost:8080/weather/forecast?lat={latitude}&lon={longitude}"

You can enter the following url with required parameters in browser.

http://localhost:8080/weather/forecast?lat={latitude}&lon={longitude}

Run using Docker

You can also run this using docker.

after cloning the repo , build the image and run it.

docker build -t {your-ideal-image-name} . # to-build
docker run --env WEB_APPID=$WEB_APPID -p 8080:8080 --name {use-creativity} -d {your-ideal-image-name}

After completing the above steps ,following options can be used to get weather information:

GUI Interface

go to http://localhost:8080 and thats it !!

Terminal

  • Current Weather

You can make a curl request

curl "http://localhost:8080/weather/current?location={city name}"

You can enter the following url with required parameters in browser.

http://localhost:8080/weather/current?location={city name}
  • Forecast Weather

You can make a curl request

curl "http://localhost:8080/weather/forecast?lat={latitude}&lon={longitude}"

You can enter the following url with required parameters in browser.

http://localhost:8080/weather/forecast?lat={latitude}&lon={longitude}

Acknowledgement

Thanks to openweathermap api

Thanks to timbru31 for java-nodejs docker image

About

Info-Weather is a java application which uses Spring-boot framework to get weather information.


Languages

Language:Java 52.6%Language:HTML 30.1%Language:Shell 7.7%Language:CSS 4.8%Language:Batchfile 4.1%Language:Dockerfile 0.7%