Last active
December 16, 2015 17:59
-
-
Save Gpx/5474596 to your computer and use it in GitHub Desktop.
Enable CSRF protection on Express
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
app.use(express.bodyParser()); // Read POST parameters | |
app.use(express.cookieParser()); // Read cookies | |
app.use(express.cookieSession({secret: 'mysecret'})); // Create a session using cookies | |
app.use(express.csrf()); // Enable CSRF protection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment