apeman-middleware-session

apeman middleware package for session.

Usage no npm install needed!

<script type="module">
  import apemanMiddlewareSession from 'https://cdn.skypack.dev/apeman-middleware-session';
</script>

README

apeman-middleware-session

Build Status Code Climate Code Coverage npm Version JS Standard

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.

Links