bzarras / newsapi

A promise-based node interface for NewsAPI
MIT License
144 stars 39 forks source link

added CORS proxy support #25

Closed DiegoVallejoDev closed 4 years ago

DiegoVallejoDev commented 4 years ago

Added this to default request options, this might enable CORS in most enviroments

const reqOptions = { 'mode': 'cors', headers: { 'Access-Control-Allow-Origin': '*' } };

Also you can now set a CORS proxy url in an options parameter if above option is not working

Example:

const NewsAPI = require('newsapi');
const newsapi = new NewsAPI('YOUR_API_KEY', { corsProxyUrl: 'https://cors-anywhere.herokuapp.com/' });
bzarras commented 4 years ago

@Destructor1702 I just made some updates to outdated packages that were long overdue for upgrades. Can you please pull from master and resolve any merge conflicts?

DiegoVallejoDev commented 4 years ago

I'm on it

DiegoVallejoDev commented 4 years ago

I need to close this pul reuest