Permalink
Browse files

Install and setup express-csrf

  • Loading branch information...
1 parent 45e062f commit dd48b9a0f5eaefef86975ebae02dd51931bad625 @skalnik committed Oct 5, 2011
Showing with 13 additions and 3 deletions.
  1. +11 −2 app.js
  2. +2 −1 package.json
View
13 app.js
@@ -3,19 +3,28 @@
* Module dependencies.
*/
-var express = require('express');
+var express = require('express'),
+ csrf = require('express-csrf');
var app = module.exports = express.createServer();
// Configuration
+app.dynamicHelpers({
+ csrf: csrf.token
+});
+
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
- app.use(app.router);
app.use(express.static(__dirname + '/public'));
+ app.use(express.cookieParser());
+ app.use(express.bodyParser());
+ app.use(express.session({'secret': 'sekretz'}));
+ app.use(csrf.check());
+ app.use(app.router);
});
app.configure('development', function(){
View
@@ -5,5 +5,6 @@
, "dependencies": {
"express": "2.4.6"
, "jade": ">= 0.0.1"
+ , "express-csrf" "0.3.3"
}
-}
+}

0 comments on commit dd48b9a

Please sign in to comment.