nati-levi / climacell-weather-widget

6 stars 1 forks source link

I can't get this to work #3

Open I-keep-trying opened 4 years ago

I-keep-trying commented 4 years ago

I know how to use environment variables to keep my api keys secret. I just want to know where to put the process.env.API_KEY? In index.js? Or in one or both of the custom hooks? The very first thing in the tutorial says, after signing up for an API key, "Copy your new api key" or something like that, but then throughout the entire rest of the tutorial, it's never pasted anywhere. It just stays there on the clipboard lol.

Also, what would be a reasonable way to provide actual location lat/lon or whatever, so the app can show weather for someplace other than Tel Aviv?

I cloned this repo, thinking it would probably be easy to just replace the url parameters with my own provided variables, but this app is too complicated. 😕

nati-levi commented 4 years ago

Hi @I-keep-trying, Thank you for this comment.

The API KEY and the lon/lat are provided to the widget in runtime. It's done via query parameters. As you can see in this example below: https://climacell-weather-widget.herokuapp.com/?apikey=YOUR_API_KEY&lat=32&lon=34&location=Tel%20Aviv. In your local machine, it would probably would be something like: http://localhost:3000/?apikey=YOUR_KEY_HERE&lat=32&lon=34&location=Tel%20Aviv

You can enter any place's lat/lon globally, and it would work. Choose for example the city you live in :)

Let me know if this works for you.