koa-session2-mongodb
v0.2.0
Published
session持久化 mongodb
Downloads
1
Readme
koa-session2-mongodb
mongodb store for koa-session2
Require
Node > 7.x
MongoDB > 3.x
Install
npm install koa-session2-mongodb -S
or
yarn add koa-session2-mongodb -S
Usage
const Koa = require('koa')
const session = require('koa-session2');
const MongoStore = require('koa-session2-mongodb');
const app = new Koa();
app.use(session({
store: new MongoStore({
url: DB_URL, // your mongodb url required
dbName: DB_NAME // your mongodb database required
})
}))
Options
url
: required, db urldbName
: required, db dbNamecollection
: optional, db session collection name,default "koa__session"maxAge
: optional, expire time, default 10 * 24 * 3600 secondsoptions
: optional, mongodb options