This application is a simple api that allows users to retrieve the weather for any city and then fill in their mood for said weather in the city.
The first thing you need to do is have a working copy of node 8.16.0+ (version written on) and npm. The next thing you'll need is a copy of the project which you can obtain with:
git clone https://github.com/C3NZ/openweather.git
After getting the project folder, you can then do:
cd openweather
npm install
This will install project dependencies/dev tools used to aid the project. To run the api, you can then do:
npm run start
After that, you are good to go! Refer to the API documentation for working with the API.
- getWeatherByCity
- getWeatherByID
- getWeatherByZipCode
- getWeatherByName
- getWeatherById
- getWeatherByZip
- handleRequest
- getMoods
- getMood
- getMoodsByCity
- postMood
Get the weather by city name through the query parameters
req
The express Request contextres
The express Response context
GET /api/v1/weather/city?city=San Francisco&country=us -> {SF weather data}
Returns any A JSON response
Get the weather by id through the query parameter: id
req
The express Request contextres
The express Response context
GET /api/v1/weather/id?id=5391959 -> {SF weather data}
Returns any A JSON response
Get the weather by city name
req
The express Request contextres
The express Response context
GET /api/v1/weather/zip?zip=94102&country=us -> {SF weather data}
Returns any A JSON response
Get the weather by the city name and the country
cityName
country
String The country for the city (optional, default"us"
)cityName-null
String The zip code for the city
weather.getWeatherByName("San Francisco", country="us") -> {SF weather data from OW}
Returns Object the weather object containing weather data about the particular area.
Get the weather by the city ID
cityID
String The city ID for the city
weather.getWeatherById(cityId) -> {City ID weather from OW}
Returns Object the weather object containing weather data about the particular area.
Get the weather by the zipcode and country
zip
String The zip code for the citycountry
String The country for the city (optional, default"us"
)
weather.getWeatherByZip(94102, country='us') -> {SF weather data from OW}
Returns Object the weather object containing weather data about the particular area.
Contact the openweather api to get weather data
url
url-null
String The endpoint url with query strings attached to make a request to.
Returns Object the weather object containing weather data about the particular area.
Get all the moods ever stored on the server
req
The Express request contextres
The Express response context
GET /api/v1/moods -> {Mood object}
Returns Object All of the stored mood data about cities
Get all the moods ever stored on the server
req
The Express request contextres
The Express response context
GET /api/v1/mood/:moodId -> {Mood object}
Returns Object The mood object for the requested mood object
Get all the moods ever stored on the server
req
The Express request contextres
The Express response context
GET /api/v1/moods/city?city=San Francisco -> [{List of mood objects}]
Returns Object the mood of an object for a particular city
Send a mood about a city to the server
req
The Express request contextres
The Express response context
POST /api/v1/moods?city=San Francisco { mood: "Happy"} -> {Mood object}
Returns Object The created mood object with information about the weather