PatrickJS / NG6-starter

:ng: An AngularJS Starter repo for AngularJS + ES6 + Webpack
https://angularclass.github.io/NG6-starter
Apache License 2.0
1.91k stars 1.35k forks source link

CORS Proxy #243

Open AndyMBridges opened 6 years ago

AndyMBridges commented 6 years ago

Hi Guys,

I'm having a CORS issue when pulling the flickr api using http.get.

(http://api.flickr.com/services/feeds/photos_public.gne)

Can someone please tell me how to integrate a proxy to bypass this? Would it be within the gulp file or the webpack setup?

Thanks, Andy

samithaf commented 6 years ago

Hey,

You can add extra middleware to browser sync server.

`import proxy from 'http-proxy-middleware'; // see how to use here https://github.com/chimurai/http-proxy-middleware`

middleware: [
proxy(`http://api.flickr.com/services/`, assign({}, proxyConfig)),
]
)