-
Notifications
You must be signed in to change notification settings - Fork 344
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
Abstract the request Handler #33
base: master
Are you sure you want to change the base?
Conversation
serverAddHandler(server, dashboard); | ||
serverAddHandler(server, home); | ||
serverAddHandler(server, session); | ||
serverAddRoute(server, NONE, NULL, notFound); |
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.
Can you think of the better way to decouple the following routing rules from main
function? I expect the modularized URI handlers can be maintained without the hooks in main
function.
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.
Do you mean separate the handler to another file?
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.
Yes, the design is intended to work with FastCGI model later: http://kristaps.bsd.lv/kcgi/
We should eliminate the dependency of given route handlers in main module.
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.
It is beyond my knowledge, I have no idea how to modify
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.
Instead, you can split the handler in a dedicated routine as cgi_url_dltrie.c does.
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.
Got it, I'll try to modify it, and notice you when it's done
By exposing the interface of
routeHandle
, the server won't call the handler directly.Thus, in this PR, I separate the route matching component.
In the future, one may combine some common shared task (middleware? eg: authetication) with routes, i.e. one can extend
routeHandle
.