diff --git a/app.js b/app.js index 089609a7..3ea5e067 100644 --- a/app.js +++ b/app.js @@ -6,6 +6,13 @@ var cli = require('./lib/app/cli'), require('colors'); var express = require('express'), + logger = require('morgan'), + bodyParser = require('body-parser'), + cookieParser = require('cookie-parser'), + session = require('express-session'), + csrf = require('csurf'), + methodOverride = require('method-override'), + serveStatic = require('serve-static'), consolidate = require('consolidate'), hogan = require('hogan.js'); @@ -153,17 +160,18 @@ function initServer (args) { .set('view engine', 'html') .engine('html', consolidate.hogan) - .use(express.logger('dev')) - .use(express.bodyParser()) + .use(logger('dev')) + .use(bodyParser.json()) + .use(bodyParser.urlencoded({ extended: true })) - .use(express.cookieParser()) - .use(express.session({key: 'express-admin', secret: 'very secret - required'})) + .use(cookieParser()) + .use(session({ key: 'express-admin', secret: 'very secret - required' })) .use(r.auth.status)// session middleware - .use(express.csrf()) + .use(csrf()) - .use(express.methodOverride()) - .use(express.static(path.join(__dirname, 'public'))) - .use(express.static(path.join(__dirname, 'node_modules/express-admin-static'))); + .use(methodOverride()) + .use(serveStatic(path.join(__dirname, 'public'))) + .use(serveStatic(path.join(__dirname, 'node_modules/express-admin-static'))); if (!args.debug) app.set('view cache', true); @@ -172,7 +180,7 @@ function initServer (args) { var assets = args.custom[key].public; if (!assets || !assets.local || !assets.local.path || !fs.existsSync(assets.local.path)) continue; - app.use(express.static(assets.local.path)); + app.use(serveStatic(assets.local.path)); } // pass server wide variables diff --git a/package.json b/package.json index dfdcf1be..b7bab9ff 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,14 @@ "url" : "git://github.com/simov/express-admin.git" }, "dependencies": { - "express" : "3.4.4", + "express" : "4.4.4", + "morgan" : "1.1.1", + "body-parser" : "1.4.3", + "cookie-parser" : "1.3.1", + "express-session" : "1.5.1", + "csurf" : "1.2.2", + "method-override" : "2.0.2", + "serve-static" : "1.2.3", "consolidate" : "0.9.1", "hogan.js" : "2.0.0", "mysql" : "2.2.0", @@ -50,4 +57,4 @@ "scripts": { "test": "make test" } -} \ No newline at end of file +}