apeman-middleware-session
v1.0.3
Published
apeman middleware package for session.
Downloads
7
Readme
apeman-middleware-session
apeman middleware package for session.
Installation
$ npm install apeman-middleware-session --save
Usage
create an middleware instance and attach to server settings like $api
of apeman projects.
Apemanfile.js
/** This is an example Apemanfile to use apeman-middleware-session */
'use strict'
const { Session } = require('./example-models')
module.exports = {
$pkg: { /* ... */ },
$api: {
/* ... */
$middlewares: [
require('apeman-middleware-session')(Session, {})
]
}
}
Signature
apemanMiddlewareSession(model, options) -> function
Create an middleware function
Args
| Name | Type | Default | Description | | --- | ---- | --- | --- | | model | Object | | Session database model. | | options | Object | {} | Optional settings | | options.key | string | | Key of session id in cookie. | | options.maxAge | number | | Max age of session duration. |
License
This software is released under the MIT License.