Weather-Go is wrapper for OpenWeatherMap API. This project is inspired by wttr. Weather-Go supports various information representation like JSON and emojified JSON weather.
This project is dockerized. Run the project with the following command:
docker-compose up -d
PS: A Nginx container is used for deploy the dockerized project.
This project uses two ENV
variables:
- Project exposed port:
NODEJS_PORT
- OpenWeatherMap API key:
WEATHER_API_KEY
Weather-Go current endpoints:
- Current weather
- By city:
/:city
- By zipcode:
/country/:country/zip/:zip
- By coordinates:
/latitude/:latitude/longitude/:longitude
- By city:
- Moon phase is available as custom parameter
- 7 days Forecasting endpoint:
- By coordinates:
forecast/latitude/:latitude/longitude/:longitude
- By coordinates:
Weather-Go currently supports these formats:
- JSON
- Emojified JSON
For receive the desired format, you have to add the format
query parameter.
The JSON format was re-format from original OpenWeatherMap response.
JSON format input: ?format=json
.
Example:
{
"currentWeather": {
"coord": {
"lon": "-0.13",
"lat": "51.51"
},
"weather": {
"main": "Clear",
"description": "clear sky"
},
...,
"visibility": "6.00 Km/h",
"wind": {
"speed": "7.56 Km/h",
"degree": "60ยฐ"
},
"country": "GB",
"city": "London",
"timezone": "1 UTC",
"sunrise": "4/16/2020, 06:01 AM",
"sunset": "4/16/2020, 07:58 PM"
}
}
You can use the emojified JSON format feature:
- Format 1:
- Format input:
?format=1
. - Response:
{ "currentWeather": "๐ 4.43ยฐC" }
- Format input:
- Format 2:
- Format input:
?format=2
. - Response:
{ "currentWeather": "๐ ๐ก๏ธ4.43ยฐC ๐ฌ๏ธโ7.56 Km/h" }
- Format input:
- Format 3:
- Format input:
?format=3
. - Response:
{ "currentWeather": "London: ๐ 4.28ยฐC" }
- Format input:
- Format 4:
- Format input:
?format=4
. - Response:
{ "currentWeather": "Detroit: โ ๐ก๏ธ-1.00ยฐC ๐ฌ๏ธโ11.16 Km/h" }
- Format input:
Custom parameters can be used if the response format is emojified JSON.
h ๐ง Humidity
p โคต๏ธ Pressure in hPa
w ๐ฌ๏ธ Wind speed in Km/h
wd โ Wind direction
t ๐ก๏ธ Temperature in Celsius
l City name
c Country code
sr ๐ Sunrise
ss ๐ Sunset
mp ๐ Moon phase
The custom
query parameter has to be provided. You can concatenate them!
Example:
Request: /London?format=1&custom=h,sr,ss,t,mp
Response:
{
"currentWeather": "โ
2.41ยฐC",
"custom": {
"humidity": "๐ง37%",
"sunrise": "๐06:48 AM",
"sunset": "๐08:14 PM",
"temperature": "๐ก๏ธ2.41ยฐC",
"moonPhase": {
"emoji": "๐",
"name": "Waning crescent",
"ilumination": "14.91%"
}
}
}
Weather-Go provides forecasting by Coordinates. All output formats and custom parameters are are available!