express-dirac-session
v1.0.1
Published
Express session middleware powered by dirac
Downloads
10
Maintainers
Readme
User and Session
Looks up the session and the user in a single query
Install:
npm install express-dirac-session
Usage:
Just like standard express session middleware, but with more options
// Tell dirac about your dal
dirac.register( require('express-dirac-session/dal') );
// Use the middleware
app.use( require('express-dirac-session')({
secret: 'blah'
// two weeks
, cookie: { maxAge: 14 * 24 * 60 * 60 * 1000 }
, resave: true
, saveUninitialized: true
// This is optional - by default, we just look up all properties on the user
, queryOptions: {
// Describe how to fetch users as a sub-query
// Also, do a one-to-many pluck on users_groups
one: [ { table: 'users', alias: 'user'
, one: []
, many: []
, pluck: [ { table: 'users_groups', alias: 'groups', column: 'group' } ]
}
]
}
}));