pat310 / google-trends-api

An API layer on top of google trends
https://www.npmjs.com/package/google-trends-api
MIT License
894 stars 178 forks source link

Having CORS issues with methods provided #56

Closed dowdje closed 7 years ago

dowdje commented 7 years ago

I am testing your api locally in Reactjs. Since your methods don't require a header, I am unable to bypass the origin allowance issues. Is there a way to bypass CORS issues with this API?

turnerniles commented 7 years ago

You need to use the Node/Express back end to make the request. Google will not allow requests to be made from the browser / front end due to CORS restriction.

pat310 commented 7 years ago

@turnerniles is right. There may be a way to bypass CORS but they are kind of hacks so I wouldn't include it in this library. I'll make it clear in the readme that there is a CORS restriction and this library is intended to be used from Node. Thanks @dowdje!