googlecodelabs / your-first-pwapp

Code associated with Your First Progressive Web App codelab
https://g.co/codelabs/pwa
Apache License 2.0
638 stars 555 forks source link

CODELAB: If running locally, set your Dark Sky API key here #167

Closed sonners closed 5 years ago

sonners commented 5 years ago

// CODELAB: If running locally, set your Dark Sky API key here

I have registered a key but don't know how to set it here. I've tried the following, e.g. const API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" //const API_KEY = process.env.DARKSKY_API_KEY; const BASE_URL = https://api.darksky.net/forecast;

but still get Dark Sky API Error: invalid json response body at https://api.darksky.net/forecast/undefined/40.7720232,-73.9732319 reason: Unexpected token F in JSON at position 0

Any help greatly appreciated.

petele commented 5 years ago

Did you replace the const API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" xs with your actual API key?

rahulmanuwas commented 5 years ago

@sonners from what I can see, you are missing a semi-colon there. I just tested it and it worked.

const FORECAST_DELAY = 0; const API_KEY = "xxxxxxxxxxxxxx"; const BASE_URL =https://api.darksky.net/forecast;`

petele commented 5 years ago

Closing due to no activity.