imgs | imgs | ||||
!imgs/.placeholder | !imgs/.placeholder | ||||
.currentRun | .currentRun | ||||
favicon.ico |
var endpoints = { | var endpoints = { | ||||
//General | //General | ||||
"/favicon.ico": "favicon.ico", | |||||
"/favicon.ico": "favicon.node.js", | |||||
"/global.css": "global.css", | "/global.css": "global.css", | ||||
"/global.js": "global.js", | "/global.js": "global.js", | ||||
"/404": "404.node.js", | "/404": "404.node.js", |
var fs = require("fs"); | |||||
module.exports = function(ctx) { | |||||
var readStream = fs.createReadStream("favicon.ico"); | |||||
readStream.pipe(ctx.res); | |||||
readStream.on("error", function(err) { | |||||
if (err.code === "ENOENT") | |||||
ctx.end(ctx.view("404")); | |||||
else | |||||
ctx.end(err.toString()); | |||||
}); | |||||
} |
readStream.pipe(ctx.res); | readStream.pipe(ctx.res); | ||||
readStream.on("error", function(err){ | readStream.on("error", function(err){ | ||||
if (err.code == "ENOENT") | |||||
if (err.code === "ENOENT") | |||||
ctx.end(ctx.view("404")); | ctx.end(ctx.view("404")); | ||||
else | else | ||||
ctx.end(err.toString()); | ctx.end(err.toString()); |