Skip to content

Instantly share code, notes, and snippets.

@EvanHahn
Created March 27, 2016 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvanHahn/860d3dae418d5e1c45e4 to your computer and use it in GitHub Desktop.
Save EvanHahn/860d3dae418d5e1c45e4 to your computer and use it in GitHub Desktop.
helmetjs/helmet#117 example app
var connect = require('connect')
var csp = require('helmet-csp')
var app = connect()
app.use(csp({
directives: {
mediaSrc: ['media.example.com']
}
}))
app.use(function (req, res) {
res.end('Hello world!')
})
app.listen(3000, function () {
console.log('app started on port 3000')
})
{
"private": true,
"scripts": {
"start": "node app"
},
"dependencies": {
"connect": "^3.4.1",
"helmet-csp": "^1.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment