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
This module lives in an abstract "make an HTTP server" package. People can now use this module to make their own HTTP sever.
But what if they want to make two HTTP servers: one for regular requests and one to serve the :6060/debug/vars requests?
They could import the module twice, but then both modules are asking for the same ParamTags group named "mux-wrappers" and there's no way for users to say which server a mux wrapper belongs to.
One solution is to change var Module into a function
Then I guess I have helpers for creating the correct mux wrapper name for users? The downside here is that I need to know ahead of time people want to use a module multiple times.
Is it possible with decorators to do something like this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Let's say I have an HTTP server module like this where the server takes an array of mux wrappers as a parameter.
This module lives in an abstract "make an HTTP server" package. People can now use this module to make their own HTTP sever.
But what if they want to make two HTTP servers: one for regular requests and one to serve the :6060/debug/vars requests?
They could import the module twice, but then both modules are asking for the same ParamTags group named "mux-wrappers" and there's no way for users to say which server a mux wrapper belongs to.
One solution is to change
var Module
into a functionThen I guess I have helpers for creating the correct mux wrapper name for users? The downside here is that I need to know ahead of time people want to use a module multiple times.
Is it possible with decorators to do something like this?
Beta Was this translation helpful? Give feedback.
All reactions