SQLite Store的默认路径 - Node.js

时间:2018-03-20 11:44:17

标签: node.js express sqlite

app.use(session({
  store: new SQLiteStore,
  secret:"xxxxxx",
  saveUninitialized: false,
  cookie: { maxAge: 60000 },
  rolling: true,
  resave: true
}));

默认情况下,在根目录中创建名为“sessions”的会话的新文件。如何更改默认路径?

1 个答案:

答案 0 :(得分:0)

var session = require('express-session');
var SQLiteStore = require('connect-sqlite3')(session);
app.use(session({
    store: new SQLiteStore({dir:'./db/', db: 'sessions'}),
    ...