Permalink
Browse files

Dump some end-of-line noise

  • Loading branch information...
1 parent e355f63 commit 0d6932995672a0556d04c41f90bc4e4169412e1d @jdub jdub committed Aug 24, 2010
Showing with 13 additions and 13 deletions.
  1. +13 −13 lib/node-router.js
View
@@ -47,7 +47,7 @@ function logify(req, res, logger) {
var end = res.end;
res.end = function () {
// Common Log Format (mostly)
- logger((req.socket && req.socket.remoteAddress) + " - - [" + (new Date()).toUTCString() + "]"
+ logger((req.socket && req.socket.remoteAddress) + " - - [" + (new Date()).toUTCString() + "]"
+ " \"" + req.method + " " + req.url
+ " HTTP/" + req.httpVersionMajor + "." + req.httpVersionMinor + "\" "
+ res.statusCode + " - \""
@@ -64,9 +64,9 @@ function logify(req, res, logger) {
exports.getServer = function getServer(logger) {
logger = logger || sys.puts;
-
+
var routes = [];
-
+
// Adds a route the the current server
function addRoute(method, pattern, handler, format) {
if (typeof pattern === 'string') {
@@ -108,7 +108,7 @@ exports.getServer = function getServer(logger) {
put(new RegExp('^/' + name + '/([^/]+)$'), controller.update, format);
del(new RegExp('^/' + name + '/([^/]+)$'), controller.destroy);
};
-
+
function resourceController(name, data, on_change) {
data = data || [];
on_change = on_change || function () {};
@@ -158,7 +158,7 @@ exports.getServer = function getServer(logger) {
}
};
};
-
+
// Create the http server object
var server = http.createServer(function (req, res) {
@@ -205,17 +205,17 @@ exports.getServer = function getServer(logger) {
res.notFound = function (message) {
notFound(req, res, message);
};
-
+
res.onlyHead = function (code, extra_headers) {
res.writeHead(code, (extra_headers || []).concat(
[["Content-Type", content_type]]));
res.end();
}
-
+
function doRoute() {
uri = url_parse(req.url);
path = uri.pathname;
-
+
for (var i = 0, l = routes.length; i < l; i += 1) {
var route = routes[i];
if (req.method === route.method) {
@@ -255,18 +255,18 @@ exports.getServer = function getServer(logger) {
res.simpleJson(200, result);
break;
}
-
+
return;
}
}
}
-
+
notFound(req, res);
}
doRoute();
});
-
+
function listen(port, host, callback) {
port = port || 8080;
@@ -282,11 +282,11 @@ exports.getServer = function getServer(logger) {
logger("node-router server instance at unix:" + port);
}
}
-
+
function end() {
return server.end();
}
-
+
// Return a handle to the public facing functions from this closure as the
// server object.
return {

0 comments on commit 0d69329

Please sign in to comment.