-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP dynamic path segments #19
HTTP dynamic path segments #19
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely a far more elegant solution than what I had written.
I rather like the usage of the constructor holding the path as the registration of the behaviour is as simple as FuyuServer.AddHttpService<FuyuBehaviour>();
instead of having the path in the function call.
I think an attribute could be looked into later. As far as adding dynamic paths I really feel like this hits the mark and should be merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this works as I think, I agree with nexus 100%. Looks very clean to me.
The code is functional and works, marked it WIP for discussion.
Inspired by #18, I implemented HTTP path arguments into
FuyuServer
.Implementation differs from @nexus4880's version by not using LINQ and using multi-threading for lookup to offset the cost of segment matching.
Discussion
I'm not happy with setting
path
insideFuyuBehaviour
's constructor. Suggestions and ideas are welcome!Since
FuyuServer
contains a unique identifier (FuyuServer.Name
), maybe we can bindFuyuBehaviour
on runtime toFuyuServer
by using a new attribute[FuyuRoute(string serverName, string path)]
and initialize FuyuBehaviour using it?