better 404 handling

This commit is contained in:
Matias Alejo Garcia 2014-12-01 14:15:02 -03:00
parent 0e42c3d54f
commit ebf5996ee1

View File

@ -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
});
};