Consuming an API Lab Exercise

In this lab, we’ll practice making requests to a 3rd party API to display weather forecast data in the browser using Express and EJS. You’ll practice working with routes, gathering user data, and integrating API responses into the UI of your application.

Set up your account

For this lab, we’ll be using the Open Weather Map API.

Follow these simple steps to get started:

Consult the Open Weather Map Documentation for how to set up your base URL:

api.openweathermap.org/data/2.5/weather?zip=[ZIP CODE],us&units=imperial&appid=[API KEY]

Set up your application

Create your index.ejs template

Handle the request and response

Render the /weather/show.ejs template

Test your app

Bonus

Try the following bonus challenges if you’re up for it!