https://github.com/jvillegasd/weather-go
Check the weather easily with emojis and moon phase!
https://github.com/jvillegasd/weather-go
express-js moon-phase node-emoji node-js openweathermap openweathermap-api wrapper-api
Last synced: 21 days ago
JSON representation
Check the weather easily with emojis and moon phase!
- Host: GitHub
- URL: https://github.com/jvillegasd/weather-go
- Owner: Jvillegasd
- Created: 2020-04-06T03:48:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T09:50:33.000Z (over 2 years ago)
- Last Synced: 2023-03-10T12:24:31.443Z (about 2 years ago)
- Topics: express-js, moon-phase, node-emoji, node-js, openweathermap, openweathermap-api, wrapper-api
- Language: JavaScript
- Homepage:
- Size: 165 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Weather-Go!
Weather-Go is wrapper for OpenWeatherMap API. This project is inspired by [wttr](https://github.com/chubin/wttr.in).
Weather-Go supports various information representation like JSON and emojified JSON weather.## Running it in local
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.## Setting Environment
This project uses two `ENV` variables:
* Project exposed port: `NODEJS_PORT`
* OpenWeatherMap API key: `WEATHER_API_KEY`## Usage
Weather-Go current endpoints:
* Current weather
* By city: `/:city`
* By zipcode: `/country/:country/zip/:zip`
* By coordinates: `/latitude/:latitude/longitude/:longitude`
* Moon phase is available as custom parameter
* 7 days Forecasting endpoint:
* By coordinates: `forecast/latitude/:latitude/longitude/:longitude`## Supported output formats
Weather-Go currently supports these formats:
* JSON
* Emojified JSONFor 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 2:
* Format input: `?format=2`.
* Response: `{ "currentWeather": "๐ ๐ก๏ธ4.43ยฐC ๐ฌ๏ธโ7.56 Km/h" }`
* Format 3:
* Format input: `?format=3`.
* Response: `{ "currentWeather": "London: ๐ 4.28ยฐC" }`
* Format 4:
* Format input: `?format=4`.
* Response: `{ "currentWeather": "Detroit: โ ๐ก๏ธ-1.00ยฐC ๐ฌ๏ธโ11.16 Km/h" }`## Custom parameters
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%"
}
}
}
## 7 days Forecasting
Weather-Go provides forecasting by Coordinates. All output formats and custom parameters are are available!