// Modules ==================================================================== var express = require('express'); var mongoose = require('mongoose'); var bodyParser = require('body-parser'); var cookieParser = require('cookie-parser'); // Application ================================================================ var app = express(); var config = require('./config/config.js'); var port = process.env.PORT || config.port; // Connection à la BDD var db = require('./config/db'); mongoose.connect(db.url); // Tricks app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); // Cookie-parser app.use(cookieParser()); // Dossier public app.use(express.static(__dirname + '/public')); // Routes require('./app/routes')(app); app.listen(port); console.log('La magie du CI se passe au port ' + port); exports = module.exports = app;