Skip to content

Conversation

mark86092
Copy link

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.

serverAddHandler(server, dashboard);
serverAddHandler(server, home);
serverAddHandler(server, session);
serverAddRoute(server, NONE, NULL, notFound);
Copy link
Owner

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.

Copy link
Author

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?

Copy link
Owner

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.

Copy link
Author

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

Copy link
Owner

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.

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants