-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (32 loc) · 1.01 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* XadillaX <[email protected]> created at 2017-03-09 18:10:13 with ❤
*
* Copyright (c) 2017 xcoder.in, all rights reserved.
*/
"use strict";
const session = require("express-session");
const RedisStore = require("connect-redis")(session);
class RedisSession {
constructor(akyuu, options) {
this.akyuu = akyuu;
this.options = options;
this.position = this.akyuu.PLUGIN_POS.BEFORE_CONTROLLER;
}
plug() {
this.akyuu.use(session({
store: new RedisStore(this.options.conn),
cookie: this.options.cookie,
genid: this.options.genid,
name: this.options.name,
proxy: this.options.proxy,
resave: this.options.resave,
rolling: this.options.rolling,
saveUninitialized: this.options.saveUninitialized,
secret: this.options.secret,
unset: this.options.unset
}));
}
}
module.exports.create = function(akyuu, options) {
return new RedisSession(akyuu, options);
};