GithubHelp home page GithubHelp logo

Add HTTP routing about proxygen HOT 18 CLOSED

facebook avatar facebook commented on May 2, 2024 1
Add HTTP routing

from proxygen.

Comments (18)

jamperry avatar jamperry commented on May 2, 2024 1

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 [email protected] 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
#77 (comment)

from proxygen.

jhonatandarosa avatar jhonatandarosa commented on May 2, 2024 1

@jamperry any update about the PR?

from proxygen.

russoue avatar russoue commented on May 2, 2024

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)?

from proxygen.

jamperry avatar jamperry commented on May 2, 2024

No problem, I will add comments to make it more clearer. I will submit a PR over the weekend.

from proxygen.

cronnosli avatar cronnosli commented on May 2, 2024

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 [email protected].

2016-01-10 16:43 GMT-02:00 James Perry [email protected]:

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
#77.

from proxygen.

aajtodd avatar aajtodd commented on May 2, 2024

Curious what the status of this is. Any updates?

from proxygen.

ovr avatar ovr commented on May 2, 2024

Any news?

from proxygen.

afrind avatar afrind commented on May 2, 2024

@jamperry are you still planning a PR?

from proxygen.

bajaarbot avatar bajaarbot commented on May 2, 2024

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.

from proxygen.

rmedaer avatar rmedaer commented on May 2, 2024

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.

from proxygen.

bajaarbot avatar bajaarbot commented on May 2, 2024

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
#77 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMKpmp-kGhk9Mv04XeaYqeBtCgErLv4kks5q8gx_gaJpZM4HB7lZ.

from proxygen.

afrind avatar afrind commented on May 2, 2024

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.

from proxygen.

GuacheSuede avatar GuacheSuede commented on May 2, 2024

@jamperry Hey James,could you post your routing example here ? Thank You, Justin

from proxygen.

VitorFalcao avatar VitorFalcao commented on May 2, 2024

Hey @afrind, is this still needed? I would like to contribute to the project and this seems like a good start.

from proxygen.

GuacheSuede avatar GuacheSuede commented on May 2, 2024

@VitorFalcao yes, help still needed

from proxygen.

UtopiaBe avatar UtopiaBe commented on May 2, 2024

Any news or example with routing ?
Thanks!

from proxygen.

afrind avatar afrind commented on May 2, 2024

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.

from proxygen.

afrind avatar afrind commented on May 2, 2024

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.

from proxygen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.