Skip to content

Instantly share code, notes, and snippets.

@PavelDemyanenko
Last active August 29, 2015 14:13
Show Gist options
  • Save PavelDemyanenko/e2cddca88214359c7933 to your computer and use it in GitHub Desktop.
Save PavelDemyanenko/e2cddca88214359c7933 to your computer and use it in GitHub Desktop.
Simple router js.
function route(pathname, routes, res) {
console.log("About to route a request for " + pathname)
if (typeof routes[pathname] === "function") {
routes[pathname](res);
} else {
console.log("No request found for " + pathname)
}
}
exports.route = route;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment