Skip to content

jwest75674/dark-sky-proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WHY?

If you going to build weather app or doing it right now hundred percent you encountered (or will do it) an issue. The issue is No 'Access-Control-Allow-Origin' header is present on the requested resource message in console when you try to fetch weather data from dark sky api. It turns out weather provider have disabled cross-origin resource sharing (CORS) on their servers. Actually you can read about it here.

Below is excerption from faq section

To prevent API key abuse, you should set up a proxy server to make calls to our API behind the scenes. Then you can provide forecasts to your clients without exposing your API key.

HOW TO USE

  1. fork it
  2. git clone to your machine
  3. yarn install
  4. register at https://darksky.net/dev/ to get you api key
  5. change .env.exampe to .env and put you api key as value to API_KEY.
  6. run it locally with yarn start before your weather app
  7. deploy your proxy-server to heroku or now when your weather app is ready for production (you need to run proxy-server live in internet in order for your weather app to work in production)
  8. make calls through the proxy with the format: https://yourURL.herokuapp.com/api/v1/json?lat=50.1234&lon=-116.1234

About

Simple proxy-server that makes calls to Dark Sky API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%