react-boilerplate icon indicating copy to clipboard operation
react-boilerplate copied to clipboard

Improve API DX

Open richardscarrott opened this issue 7 years ago • 3 comments

The initial intention of the Node server was to just render the client react app and serve static assets which is why the webpack server bundle get's hot reloaded but the regular api routes don't.

We can't use nodemon to restart the server every time because that'd cause the webpack middlewares to restart which would be sloooooow so it'd be good to investigate a nice solution for this...may have to start two servers and proxy requests from the API server to the dev server although this is something I was hoping to avoid.

richardscarrott avatar Nov 24 '16 22:11 richardscarrott

Hi @richardscarrott, have you found a solution for that?

monteiz avatar Jul 26 '17 05:07 monteiz

@monteiz I recently implemented webpack-hot-server-middleware on another project where the api was reasonably substantial so we needed live reload.

The only solution I found was to use nodemon on the main server and proxy requests to a custom dev server which mounts webpack-dev-middleware and webpack-hot-server-middleware. It works fine but just means you need to start up two servers during development.

richardscarrott avatar Sep 08 '17 11:09 richardscarrott

@richardscarrott I have ended up doing the same thing in fact, thanks.

monteiz avatar Sep 08 '17 11:09 monteiz