From ebf5996ee1ea34026aec04ddfa559ea80eddb571 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 1 Dec 2014 14:15:02 -0300 Subject: [PATCH] better 404 handling --- app/controllers/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/index.js b/app/controllers/index.js index a31286d..52e67fe 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -8,8 +8,13 @@ var _getVersion = function() { }; exports.render = function(req, res) { + if (config.publicPath) { - return res.sendfile(config.publicPath + '/index.html'); + return res.sendfile(config.publicPath + '/index.html', {}, function(err) { + res.status(404).json({ + error: err + }).end(); + }); } var version = _getVersion(); @@ -18,6 +23,7 @@ exports.render = function(req, res) { exports.version = function(req, res) { var version = _getVersion(); - res.json({ version: version }); + res.json({ + version: version + }); }; -