koajs / generic-session

koa session store with memory, redis or others.
MIT License
414 stars 65 forks source link

How use session? #113

Closed wuchuguang closed 4 years ago

wuchuguang commented 7 years ago

var session = require('koa-generic-session'); app.keys = ['key', 'keySid']; app.use(session());

app.use(routes.get("/test", function *(next){ //How to use session in this context ? this.session.set('aaa', 100);//report set undefined // or this.session.aaa = "100";// not report error ,but i can't get aaa value like this.session.aaa

}));