You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That seems like something you would have to program yourself because it would require client-side scripting. Once a server sends a webpage, it stops communicating with the client until the client makes another request. Therefore, the server can't tell your browser that index.html has changed unless you send a request yourself.
So what are the chances of the http-server binary adding support for a custom handler? Looking at lib/http-server.js, it does take a before option that would allow wiring up a project specific handler. Then it would be up to that handler to implement a change watcher and do any payload injection to facilitate live reloading.
Basically what I'd like is something like:
$ http-server --before ./my_handler
And then we'd implement various functions in my_handler.js like:
handle(req, res) basic stateless handler that needs no options
or createHandler(options) => ((req, res) => void) a handler constructor that take some of the server options like { root, logFn } to name a couple
Environment Versions
Expected result
Actual result
The text was updated successfully, but these errors were encountered: