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
web.Get("/", handler)
web.Get("/somethingelse", anotherHandler)
// etc.
There is no way (AFAIK) to get the http.Handler behind this (in case you'd like to wrap it in some middleware, etc.). All you can do is create a new Server and then rewrite the code to use it (rather than the module-level functions that work on the main server).
I don't think there would be any trouble with exposing mainServer publicly, kind of like http.DefaultServeMux is exposed (feel free to correct me). If you don't care about an extra variable lying around, then it's a one-line fix:
varMainServer=mainServer
(otherwise you'd have to s/mainServer/MainServer everywhere).
I'd like to hear some feedback on this. Would anyone else find this useful? Is this more complex than I think and there'd be some weird problems?
The text was updated successfully, but these errors were encountered:
At the moment, if you've written a code like
There is no way (AFAIK) to get the http.Handler behind this (in case you'd like to wrap it in some middleware, etc.). All you can do is create a new
Server
and then rewrite the code to use it (rather than the module-level functions that work on the main server).I don't think there would be any trouble with exposing
mainServer
publicly, kind of likehttp.DefaultServeMux
is exposed (feel free to correct me). If you don't care about an extra variable lying around, then it's a one-line fix:(otherwise you'd have to
s/mainServer/MainServer
everywhere).I'd like to hear some feedback on this. Would anyone else find this useful? Is this more complex than I think and there'd be some weird problems?
The text was updated successfully, but these errors were encountered: