Closed oh-its-jimjam closed 3 years ago
Hi @jamperry, thanks for your interest to contribute, we definitely welcome your contribution. Would you be able to submit a PR with some documentation (may be in the form of comments in the code)?
No problem, I will add comments to make it more clearer. I will submit a PR over the weekend.
I have to that by doing this!
restRoutes.routeAdd("/indexation/test", "testIndexation",{"POST"}); restRoutes.routeAdd("/status", "getStatus",{"GET","POST"});
void Routes::routeAdd(std::string path, std::string action, acceptedMethods methods) { boost::mutex::scoped_lock scope_lock(Route); this->methods[path] = methods; this->actions[path] = action; }
bool Routes::routeExist(std::string path) ;
std::string Routes::getAction(std::string path);
bool Routes::routeMethodValid(std::string path, std::string method);
sRequest Server::request(restHeader header) {
sRequest responseBuild;
responseBuild.status = 200;
bool routeExist = restRoutes.routeExist(header["path"]);
bool methodAccepted = restRoutes.routeMethodValid(header["path"],
header["method"]);
if (routeExist && methodAccepted) {
this->action = restRoutes.getAction(header["path"]);
logger.info("Executin action: %s => method: %s route: %s",
action.c_str(), header["method"].c_str(), header["path"].c_str()); } else if (!routeExist) { responseBuild.message = "Route not found"; responseBuild.status = 404; logger.error("Route not found => method: %s route: %s", header["method"].c_str(), header["path"].c_str()); } else if (!methodAccepted) { responseBuild.message = "Method not Applied"; responseBuild.status = 405; logger.error("Method is not accepted for this route => method %s route: %s", header["method"].c_str(), header["path"].c_str()); }
if (responseBuild.status != 200) {
responseBuild.body = "";
}
return responseBuild;
}
Douglas M Cordeiro cronnosli@gmail.com.
2016-01-10 16:43 GMT-02:00 James Perry notifications@github.com:
I have written a HTTP router by extending RequestHandlerFactory to multiplex paths to RequestHandler implementations. The routing uses a compacted prefix tree.
Is this something you are interested in having in your repo or should I create a separate repo for it? If you are interested then I will merge it with tests into a public fork and then submit a PR.
— Reply to this email directly or view it on GitHub https://github.com/facebook/proxygen/issues/77.
Curious what the status of this is. Any updates?
Any news?
@jamperry are you still planning a PR?
really sorry for the lack of reply. yes i still plan a PR - realistically next month. i was, and still am, crunching this month with the upcoming release of our cloud service (uses proxygen). once crunching is over, i can ship a PR.
On 22 March 2016 at 20:45, afrind notifications@github.com wrote:
@jamperry https://github.com/jamperry are you still planning a PR?
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/facebook/proxygen/issues/77#issuecomment-200016503
@jamperry any update about the PR?
Sharing a constexpr
based PrefixRouter along with a sample application at https://github.com/bajaarbot/proxygen_template.
Maybe OP is referring to marisa-trie if someone wants to try that instead.
Hi guys,
FYI: I implemented a small router based on libr3: https://github.com/rmedaer/proxygen-routing
@jhonatandarosa @jamperry not sure to understand why it should be embedded in Proxygen library itself... @bajaarbot mine is using r3.
Nice work. Just be warned that tries can take a hit on cache-misses.
Check this recent discussion (https://news.ycombinator.com/item?id=12914495), specifically the comment on LCPs. Another option is to generate a hash : (prefix) => [array of matching routes]
On 11/09/2016 11:40 PM, Raphaël Medaer wrote:
Hi guys,
FYI: I implemented a small router based on libr3: https://github.com/rmedaer/proxygen-routing
@jhonatandarosa https://github.com/jhonatandarosa @jamperry https://github.com/jamperry not sure to understand why it should be embedded in Proxygen library itself... @bajaarbot https://github.com/bajaarbot mine is using r3.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/facebook/proxygen/issues/77#issuecomment-259483047, or mute the thread https://github.com/notifications/unsubscribe-auth/AMKpmp-kGhk9Mv04XeaYqeBtCgErLv4kks5q8gx_gaJpZM4HB7lZ.
It seems like folks are building this on their own in a variety of different ways. If someone really likes their implementation and would like to incorporate it into the library, submit a PR and we will review it. In the meantime, we recommend that if you need this functionality you grab it from one of the linked projects.
@jamperry Hey James,could you post your routing example here ? Thank You, Justin
Hey @afrind, is this still needed? I would like to contribute to the project and this seems like a good start.
@VitorFalcao yes, help still needed
Any news or example with routing ? Thanks!
I think there's a reasonable example in the early comments. Not much news. We are planning to open source more HTTP components in the coming months, but I'm not sure this is prioritized. We'd still welcome a PR for a generic router/dispatcher component for the HTTP-server.
I'm going to close this issue - but if someone has a component to share feel free to put up a PR and reopen/link it here.
I have written a HTTP router by extending
RequestHandlerFactory
to multiplex paths toRequestHandler
implementations. The routing uses a compacted prefix tree.Is this something you are interested in having in your repo or should I create a separate repo for it? If you are interested then I will merge it with tests into a public fork and then submit a PR.