Skip to content

Commit

Permalink
No default routes, not even for favicons.
Browse files Browse the repository at this point in the history
  • Loading branch information
ringmaster committed Aug 3, 2011
1 parent 3d11cca commit dac5932
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions lib/jqNode.js
Expand Up @@ -19,25 +19,21 @@ function route(request, response) {
console.log("Received " + method + " request at " + pathName);
}

if(pathName === "/favicon.ico") {
$.writeFile("favicon.ico", "image/x-icon");
} else {
if(handler = routes[pathName][method]){
if(method === "POST") {
_data = "";
request.addListener("data", function(chunk) {
_data += chunk;
});
request.addListener("end", function() {
handler(request, response, require('querystring').parse(_data));
});
} else {
handler(request, response, _data);
}
if(handler = routes[pathName][method]){
if(method === "POST") {
_data = "";
request.addListener("data", function(chunk) {
_data += chunk;
});
request.addListener("end", function() {
handler(request, response, require('querystring').parse(_data));
});
} else {
response.writeHead(200, {'Content-Type' : 'text/html'});
response.end("<h1>404. Not found.</h1>");
}
handler(request, response, _data);
}
} else {
response.writeHead(200, {'Content-Type' : 'text/html'});
response.end("<h1>404. Not found.</h1>");
}
}

Expand Down

0 comments on commit dac5932

Please sign in to comment.