Last active
August 29, 2015 14:13
-
-
Save PavelDemyanenko/e2cddca88214359c7933 to your computer and use it in GitHub Desktop.
Simple router js.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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