koa2-cookie-session
v0.0.1
Published
Middleware for Koa2 cookie session
Downloads
17
Maintainers
Readme
koa2-cookie-session
Middleware for Koa2 cookie session
Install
npm install koa2-cookie-session --save
Usage
import Koa from "koa";
import session from "koa2-cookie-session";
const app = new Koa();
//Options
app.use(session({
key: "SESSIONID", //default "koa:sid"
expires:3, //default 7
path:"/" //default "/"
}));
app.use(ctx => {
ctx.session.user = {
name: "myname"
};
ctx.body = ctx.session;
});
License
MIT