Separate server and app initialization into two parts (optional)
See original GitHub issueOpening a new issue for this idea. This conversation originally started on #56. Relevant comment below.
The way I have middleware setup also makes it difficult for the same reason. I totally understand why you have done it the way you have for the most convenient case. In the middleware chain I have, there is no good place where server and app are available together at a point where the routing can be changed. All the middleware for the app is setup in advance including the error handling and this is a separate module. This module is then required by the serving module, which decides whether it should start an HTTP or HTTPS server for the app. Is it possible to separate out where the route is added so that I can do it in two steps? So I would have to add code in two places for reload to work in this way:
during routing:
reload.configureRoute(app)
then another function that wouldn’t need the app:
reload.websocketServer(server)
I think the module would need another way to instantiate so it wasn’t always returning the single function. I can put together a PR if you think it is feasible to include it?
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
Resolved by c00ac1a4b00551885d4876c796a9f9cc8080b363 in pull request #71
If I needed it to work that way, I could just use the venerable webpack-dev-server. The way that fork works is hijacking the way static content is served which won’t work for my middleware chain. Using this package means you can use the express static middleware.