From 8ed4d6592a55d0a3666ededdfc213981ad73514b Mon Sep 17 00:00:00 2001
From: Geoffrey Frogeye <geoffrey@frogeye.fr>
Date: Mon, 13 Apr 2015 00:21:06 +0200
Subject: [PATCH] Favicon et meilleur routage

---
 app/routes.js      |  9 +++++++++
 package.json       |  1 +
 public/favicon.ico | Bin 0 -> 32988 bytes
 server.js          |  3 ---
 4 files changed, 10 insertions(+), 3 deletions(-)
 create mode 100644 public/favicon.ico

diff --git a/app/routes.js b/app/routes.js
index 0d525f2..ce3e23c 100644
--- a/app/routes.js
+++ b/app/routes.js
@@ -1,10 +1,18 @@
 var path = require('path');
 var api = require('./routes/ApiRtes');
+var favicon = require('serve-favicon');
+var express = require('express');
 
 module.exports = function (app) {
 
+    // Statique
+    app.use(favicon(path.normalize(__dirname + '/../public/favicon.ico')));
+    app.use(express.static(path.normalize(__dirname + '/../public')));
+
+    // API
     app.use('/api/', api);
 
+    // Défaut
     app.get('*', function (req, res) {
         if (req.accepts('text/html')) {
             res.sendFile('public/views/index.html', {
@@ -15,6 +23,7 @@ module.exports = function (app) {
         }
     });
 
+    // Mauvaise requête
     app.all('*', function (req, res) {
         res.send(405).end();
     });
diff --git a/package.json b/package.json
index bf0d2e5..c6e35fc 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
     "mongoose": "^4.0.1",
     "node-cache": "^1.1.0",
     "node-line-reader": "0.0.2",
+    "serve-favicon": "^2.2.0",
     "ssh2": "^0.4.6",
     "ursa": "^0.8.4"
   }
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..bf791c2
Binary files /dev/null and b/public/favicon.ico differ
diff --git a/server.js b/server.js
index fecad51..96c07ee 100644
--- a/server.js
+++ b/server.js
@@ -23,9 +23,6 @@ app.use(bodyParser.urlencoded({
 // Cookie-parser
 app.use(cookieParser());
 
-// Dossier public
-app.use(express.static(__dirname + '/public'));
-
 // Routes
 require('./app/routes')(app);
 
--
libgit2 0.21.2