PatrickJS-starter icon indicating copy to clipboard operation
PatrickJS-starter copied to clipboard

How to combine webpack-dev-server with custom node server

Open codingwithrachel opened this issue 10 years ago • 2 comments

Could anyone kindly give guidance to how to configure combining webpack-dev-server in the starter with a custom node server so that all requests will be directed to the custom node server? The webpack documentation doesn't go in depth on using the proxy method.

The custom node server lives on localhost:3001 and webpack-dev-server runs on localhost:3000. Seems like the below is working...

In webpack.dev.js, devServer: { proxy: { '*': 'http://localhost:3001' } } What should be served as index.html by the custom node server?

Thank you in advance.

https://webpack.github.io/docs/webpack-dev-server.html (Combining with an existing server part)

codingwithrachel avatar Sep 12 '16 15:09 codingwithrachel

I haven't tried it myself, but https://github.com/angular/universal-starter might help I would love to hear your findings

Bnaya avatar Sep 12 '16 16:09 Bnaya

proxy: { '**': 'http://localhost:3001' } and making calls to http://localhost:3000/someroute worked :) Closing the issue.

codingwithrachel avatar Sep 14 '16 15:09 codingwithrachel