bragg-safe-guard
v2.0.0
Published
Prevents leaking information outside the bragg context
Downloads
480
Maintainers
Readme
bragg-safe-guard
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