A small weather application that uses http requests to get the current weather in a given location.
Clone the repository into your own directory.
git clone https://github.com/lukejcn/weather-app.git
cd into the new directory and npm install
which will download and install the required npm packages
cd weather-app
npm install
The application connects to two APIs:
- MapBox - Used to obtain latitude and longtitude information from an address passed as a string.
- Weatherstack - Used to obtain weather information using the latitude and longtitude from the mapbox API.
You'll need to sign up to both of these and obtain API keys to get this app to work.
- Sign up for a free account at https://weatherstack.com/
- Visit the dashboard and get your API key
- Sign up for a free account at https://www.mapbox.com
- Visit your account and get your API Key
Now that you have your API keys, you need to load them into the app. In the project's directory, create a .env
file. Then, create two variables for your API keys called WEATHERSTACK_API
and MAPBOX_API
nano .env
WEATHERSTACK_API=************
MAPBOX_API=****************
- Node.js
npm run start
Run in Development mode with nodemon
npm run dev
This uses the nodemmon npm package that's a development dependency - will be uninstalled when the app is put into production