Hacker News new | ask | show | jobs
by aliezsid 2169 days ago
I create a tree similar to the file structure that is used by the actual router when it handles requests to figure out which handler to pass the `req` and `res` objects. This is in the stable(`master`) branch.

The `canary` branch implements the same thing but instead of a object tree , it creates a flat object and uses regex's to find the registered handler which is faster but creates an overlap which I'm trying to fix.

In simple senses, it there's to make sure that the router only passes down the req,res to the valid handler and doesn't do any other processing other than maybe, query parsing and param parsing