Skip to content

Commit

Permalink
Update to use Express 4. Fixes #54.
Browse files Browse the repository at this point in the history
  • Loading branch information
shortstuffsushi committed Jun 25, 2014
1 parent d786684 commit 0ee504d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
26 changes: 17 additions & 9 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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);

Expand All @@ -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
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -50,4 +57,4 @@
"scripts": {
"test": "make test"
}
}
}

0 comments on commit 0ee504d

Please sign in to comment.