-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.md.vswp
38 lines (34 loc) · 1.05 KB
/
README.md.vswp
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
38
vnote_backup_file_826537664 /Users/andrewjones/Programs/javascript/express-sql-session-promise-adapter/README.md
# express-sql-session-promise-adapter
**note: this is no longer necessary sql session now supports promises**
default: promiseAdapter
let's you use mysql2 promises with express-mysql-session
```
import promiseAdapter from 'express-session-mysql2-promise-adapter';
import express from 'express';
import session from 'express-session';
import SQLSession from 'express-mysql-session';
import mysqlPromise from 'mysql2/promise';
export let db = mysqlPromise.createConnection({
host: '127.0.0.1',
port: 3306,
user: process.env.SESSION_DB_USER,
password: process.env.SESSION_DB_PASSWORD,
database: process.env.SESSION_DB,
connectTimeout: 600
});
const port = 8085;
const SQLStore = SQLSession(session);
const sessionStore = new SQLStore({}, promiseAdapter(db));
const localSession = {
store: sessionStore,
secret: 'test_secret',
resave: true,
rolling: true,
saveUninitialized: true,
cookie: {
maxAge: 99999,
httpOnly: false
}
};
```