Fork this repo
Create a CLI app by using the Commander package, which is capable of fetching and displaying weather data using a clear command line interface.
Your CLI should expose two features (two different commands):
-
get-temp
- Fetch and display the temperature of a certain city. The output should be in the following format:Structure:
It's <temp> degrees in <city name>
Example:
It's 27.6 degrees in Tel Aviv
Arguments:
- The first argument is the city name (mandatory).
- Optional argument:
-s
,--scale
for eitherc
(celsius) orf
(fahrenheit). The default should be celsius.
-
get-detailed-forecast
(bonus) - Fetch and display the detailed weather forecast of a certain city. The output should display the following details:
-
Weather description
-
Min and max temperature
-
Wind speed
Structure:
Today we will have <weather description>, temperatures will range from <min temp> to <max temp> with a wind speed of <wind speed>
Example:
Today we will have clear sky, temperatures will range from 26 to 32 degrees with a wind speed of 4.12
Arguments:
- The first argument is the city name (mandatory).
- Optional argument:
-s
,--scale
for eitherc
(celsius) orf
(fahrenheit). The default should be celsius.
- Use the node-fetch package in order to call the openweathermap API using your existing API key.
- Your API key should be stored in a
.env
file. Refer to the guidelines in the lecture slides. - The required data for both of the commands can be fetched by using the endpoint in this part of the API reference.
- Use the
URLSearchParams
native class in order to build the query string, and append it to the request url. - Handle errors of your API requests, and write logs on each error which include the command arguments and the error details. You'll be using the logger module that you've published during workflow-5!
- Create a nice user experience for the users of your CLI - Set a clear description for each command and its arguments.
- Install and use our own published logger - the
mondayu-logger
package in case you don't have your own logger package published.