diff --git a/app/routes.js b/app/routes.js index 8c3ff0a..0d525f2 100644 --- a/app/routes.js +++ b/app/routes.js @@ -6,7 +6,17 @@ module.exports = function (app) { app.use('/api/', api); app.get('*', function (req, res) { - res.sendFile('public/views/index.html', { root: path.normalize(__dirname + '/..') }); + if (req.accepts('text/html')) { + res.sendFile('public/views/index.html', { + root: path.normalize(__dirname + '/..') + }); + } else { + res.send(404).end(); + } + }); + + app.all('*', function (req, res) { + res.send(405).end(); }); }; diff --git a/app/routes/ApiRtes.js b/app/routes/ApiRtes.js index 3370b8f..3e04d73 100644 --- a/app/routes/ApiRtes.js +++ b/app/routes/ApiRtes.js @@ -229,7 +229,12 @@ api.delete('/messs/:mess_id', reqPerm('canDelMess'), function (req, res) { // Su }); }); -// TODO 404 -// TODO 418 +api.all('/coffee', function (req, res) { + res.status(418).end(); +}); + +api.all('*', function (req, res) { + res.status(405).end(); +}); module.exports = api; diff --git a/public/js/app.js b/public/js/app.js index 92e69d1..c99ded9 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -22,6 +22,9 @@ angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'F .when('/connect', { templateUrl: 'views/connect.html', controller: 'ConnectCtrl' + }) + .otherwise({ + redirectTo: '/' }); $locationProvider.html5Mode(true); } -- libgit2 0.21.2