express-locals
v1.0.1
Published
Mixin properties into the `res.locals` object for each request
Downloads
5
Maintainers
Readme
Express Locals
Mixin properties into the
res.locals
object for each request
Usage
app.get('/my-route'
, require('express-locals')({
hello: 'world'
, objects: [{ a: 1 }, { a: 2 }, a: 3 }]
})
, function( req, res ){
res.send( res.locals.hello );
}
);
Install
npm i -S express-locals
Test
npm test
Options
{
// Deep clones the passed in object at each request
cloneDeep: true // (default)
}
usage:
app.get('/my-route'
, require('expresss-locals')({ a: 1 }, { cloneDeep: false })
, myHandler
);