How to use the MemoryStore function from express-session

Find comprehensive JavaScript express-session.MemoryStore code examples handpicked from public code repositorys.

13
14
15
16
17
18
19
20
21
22
var expressSession = require('express-session');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var cookieParser = require('cookie-parser');

var sessionStore = new expressSession.MemoryStore();
var app = express();
var http = require('http').Server(app);

var response_options = {root: __dirname};
fork icon145
star icon280
watch icon29

+ 3 other calls in file

24
25
26
27
28
29
30
31
32
}
const appId = requireOption('appId');
const appSecret = requireOption('appSecret');
const loginPath = requireOption('loginPath');

store = options.store || new MemoryStore();
if (typeof store.set !== 'function' || typeof store.get !== 'function') {
    throw new Error('wafer-node-session 初始化失败:不是合法的 store');
}
fork icon13
star icon81
watch icon34

13
14
15
16
17
18
19
20
21
22

export function buildKeycloakApolloConfig(app: Express, apolloConfig: any) {
    const graphqlPath = `/graphql`;
    console.log("Using keycloak configuration")

    const memoryStore = new session.MemoryStore()
    app.use(session({
        secret: process.env.SESSION_SECRET_STRING || 'this should be a long secret',
        resave: false,
        saveUninitialized: true,
fork icon5
star icon45
watch icon12

-3
-2
-1
const session = require('express-session');

module.exports = new session.MemoryStore();
fork icon1
star icon8
watch icon4

49
50
51
52
53
54
55
56
57
58

```js
const session = require('express-session');

app.use(session({
  store: isDev ? new session.MemoryStore() : MongoStore.create(options)
}));
```

> You can also take a look at [example](example) directory for example usage.
fork icon351
star icon0
watch icon53

2
3
4
5
6
7
 */

//core
var expressSession = require('express-session');

module.exports = new expressSession.MemoryStore();
fork icon1
star icon28
watch icon0