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
var fs = require('fs'); | |
// In your app.js, include a route handler for all other routes (*) to go to error404. | |
// app.get('*', error.error404); | |
exports.error404 = function(req, res) { | |
if (req.accepts('html')) { | |
// Respond with html page. | |
fs.readFile(__dirname + '/../../public/404/index.html', 'utf-8', function(err, page) { | |
res.writeHead(404, {'Content-Type': 'text/html'}); | |
res.write(page); |