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
I'm trying to find a way to have routes, that would NOT carry routing information (so no Pattern() method), but instead to define routing information at the moment I register my routes:
func AsRoute(pattern string, f any) any { // how to do ?}
fx.Provide(
AsRoute("/echo", NewEchoHandler),
AsRoute("/hello", NewHelloHandler),
),
I tried to play with Annotate and making structs that would hold the hanldler constructor function + the pattern, but I can find a way to make this work.
If you have any suggestions, it would be greatly appreciated !
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
-
Hello team, first of all, congrats for Fx, it's amazing.
In your example, you do the following:
and register a route with the following
I'm trying to find a way to have routes, that would NOT carry routing information (so no
Pattern()
method), but instead to define routing information at the moment I register my routes:I tried to play with
Annotate
and making structs that would hold the hanldler constructor function + the pattern, but I can find a way to make this work.If you have any suggestions, it would be greatly appreciated !
Beta Was this translation helpful? Give feedback.
All reactions