react-redux-starter-kit icon indicating copy to clipboard operation
react-redux-starter-kit copied to clipboard

Shared server code

Open jmarlow4 opened this issue 11 years ago • 3 comments

So I've noticed there are 3 different servers, Koa/Production, Test, and Webpack-Dev. My question is, is there any shared server code besides what's in the config file? If I wanted to put in my own API that interfaces with a database, websockets, or other features, is there already a file I could put that that would then be accessible to all 3 different servers? Or would I have to create an entirely new module and import to all three separately?

Also, and this isn't quite as important, when I run the dev server, Wappalyzer says that the app is built with Express, is that because Webpack uses express to serve the files? I'm just curious.

jmarlow4 avatar Sep 23 '15 16:09 jmarlow4

To answer your last question: yes, Webpack's dev server uses Express to serve assets. From http://webpack.github.io/docs/webpack-dev-server.html:

The webpack-dev-server is a little node.js Express server, which uses the webpack-dev-middleware to serve a webpack bundle.

For the first question, this is where things get trickier. Given the current setup, you would most likely integrate it all in the Koa server and spin that up alongside the Webpack dev server, then have your client application point its API requests to the Koa server. There's no current connection between the webpack-dev-server and Koa; if you're looking to get rid of webpack-dev-server and have everything served from a single app server, there's some discussion around that here: https://github.com/davezuko/react-redux-starter-kit/issues/58 (specifically the last comment).

dvdzkwsk avatar Sep 23 '15 16:09 dvdzkwsk

Fascinating. Alright I'll look issue #58 in greater depth and get back to you if I have anymore questions. You've been incredibly helpful. Thank you!

jmarlow4 avatar Sep 23 '15 17:09 jmarlow4

Closing this since the starter kit no longer comes with a server.

dvdzkwsk avatar Sep 30 '15 16:09 dvdzkwsk