forked from manuelkiessling/nodebeginner.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Herman A. Junge
committed
Jun 28, 2011
1 parent
16d33d3
commit 4a7801b
Showing
5 changed files
with
268 additions
and
247 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
// router.js | ||
// Ejemplo de NodeBeginner | ||
// Se intenta traducir al máximo al Español, | ||
// sin embargo, con el fin de preservar el sentido, se dejan | ||
// algunas variables en inglés. | ||
|
||
function route(handle, pathname, response, request) { | ||
|
||
// Ojo! A node.js no le gustan los strings con acentos | ||
// No he probado los character entities a ver si ayudan aca. | ||
console.log("A punto de rutear una peticion para " + pathname); | ||
if (typeof handle[pathname] === 'function') { | ||
handle[pathname](response, request); | ||
} else { | ||
} | ||
else { | ||
console.log("No hay manipulador de peticion para " + pathname); | ||
response.writeHead(404, {"Content-Type": "text/html"}); | ||
response.write("404 No Encontrado"); | ||
response.end(); | ||
} | ||
} | ||
|
||
exports.route = route; | ||
exports.route = route; |
This file contains 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
Oops, something went wrong.