Where do I find api information about req.sessionStore?
I was checking out a library applying:
Object.defineProperty(this, 'req', { value: req });
this.req.sessionStore.set(this.id, this, fn || function(){});
https://github.com/btd/connect-session/blob/master/lib/session/session.js#L24
But haven't been successful finding the api thusfar.
Alternative documentation about request.sessionStore is welcome.
Short Answer all the store methods can be obtained here: https://github.com/expressjs/session#session-store-implementation
Long Answer It took 3 steps to debug this
First where is the req.sessionstore coming from?
https://github.com/btd/connect-session/blob/master/lib/session.js#L78
// expose store
req.sessionStore = store;
Second, what is the store, it can be passed via options while creating the session or it will pick from MemoryStore
https://github.com/btd/connect-session/blob/master/lib/session.js#L46
store = options.store || new MemoryStore
Third, MemoryStore is where we have all the setter methods
https://github.com/btd/connect-session/blob/master/lib/session/memory.js#L67
MemoryStore.prototype.set
Since connect and express share similar middlewares, for other compatible sessionstores instead of default MemoryStore, you can refer to
https://github.com/expressjs/session#compatible-session-stores
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.