simple-csp
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Very simple Content Security Policy (CSP) manager

Usage

var express = require( 'express' );
var app = express();
var csp = require( "simple-csp" );

var csp_headers = {
    "default-src": ["'self'", "http://example.com"],
    "connect-src": ["'self'", "http://example.com"],
    "img-src": ["'self'", "data:", "http://example.com"]
};

app.use( "/", function ( req, res, done ) {
    csp.header( csp_headers, res );
    done();
} );

// Static files from ./public
app.use( "/", express.static( "./public" ) );

app.listen( 8888 );

Package Sidebar

Install

npm i simple-csp

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

3.91 kB

Total Files

5

Last publish

Collaborators

  • starak