Interactive Node.js CLI that fetches current conditions and a short forecast from the Weatherstack API, then displays the results with colorized, readable formatting.
- Node.js 16+ (global
fetchis not required; the project bundlesnode-fetch) - Weatherstack account with an API key (sign up at weatherstack.com)
npm install
export WEATHERSTACK_API_KEY=your_access_key_hereRun the CLI with either npm start or the installed binary:
npm start
# or, after a global or local install
npx world-weatherThe tool will prompt for a city or location name, call http://api.weatherstack.com/forecast, and then print the current readings plus the next few days of forecast data. If your Weatherstack plan does not include the forecast endpoint, the CLI automatically falls back to the current-conditions endpoint and will let you know that forecast data is unavailable.
You can find the complete Weatherstack API reference, quickstart, and plan details at https://weatherstack.com/documentation.
If you want to experiment without hitting the API, store any sample Weatherstack response locally and inspect it with jq or another JSON viewer.