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

Proxy outgoing requests to custom API server in dev mode #198

Closed aneeshd16 closed 7 years ago

aneeshd16 commented 7 years ago

Hi, in prod mode, I would be serving the dist folder via my node server, all outgoing API requests from the client will be on the /api/* path. This works fine. In dev mode, the client is served at localhost:3000 by the dev server, and I need to proxy all outgoing requests on the /api/* path to a different port on localhost. I added this to webpack.dev.config.js, but it does not work.

config.proxy = {
  '/api/*': 'http://localhost:4000/'
};

Thanks for the help!

fesor commented 7 years ago

https://github.com/AngularClass/NG6-starter/blob/master/gulpfile.babel.js#L79

Here you can add browsersync proxy config.