npm

Need private packages and team management tools?Check out npm Orgs. »

bragg-safe-guard

1.0.0 • Public • Published

bragg-safe-guard Build Status

Prevents leaking information outside the bragg context

Install

$ npm install --save bragg-safe-guard

Usage

const bragg = require('bragg');
const safeGuard = require('bragg-safe-guard');
 
const app = bragg();
 
app.use(ctx => {
    ctx.body = {
        foo: 'bar',
        unicorn: 'rainbow',
        user: {
            name: 'Hello',
            password: 'world'
        }
    };
});
 
app.use(safeGuard('unicorn', 'user.password'));
 
app.use(ctx => {
    console.log(ctx.body);
    //=> {foo: 'bar', user: {name: 'Hello'}}
});
 
exports.handler = app.listen();

API

safeGuard(...properties)

Returns a bragg middleware function.

properties

Type: string[]

List of properties to be removed from the body before sending the response.

Related

  • bragg - AWS λ web framework

License

MIT © Sam Verschueren

install

npm i bragg-safe-guard

Downloadsweekly downloads

39

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability