mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
refactor: middlewares
This commit is contained in:
1 parent
7c1d83ccd3
commit
5e8df7ae01
8 files changed
+53
-39
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import session from 'express-session'
|
||||
import MongoStore from 'connect-mongo'
|
||||
|
||||
import config from '../config.js'
|
||||
|
||||
export default session({
|
||||
secret: config.secret,
|
||||
resave: false,
|
||||
saveUninitialized: false,
|
||||
rolling: true,
|
||||
cookie: {
|
||||
domain: config.domain,
|
||||
httpOnly: true,
|
||||
secure: config.protocol === 'https:',
|
||||
sameSite: 'strict',
|
||||
maxAge: config.sessionMaxAge,
|
||||
},
|
||||
store: MongoStore.create({
|
||||
mongoUrl: config.db,
|
||||
collectionName: 'loginSessions',
|
||||
}),
|
||||
})
|
||||
Reference in new issue
Block a user