Created
June 7, 2024 09:04
-
-
Save gensart-x/78159197bcaae3b411cf9f2e4d5f596f to your computer and use it in GitHub Desktop.
Session setup, filesystem-based, Express Session for Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Session Setup | |
import sessionFileStore from 'session-file-store'; | |
import expressSession from 'express-session'; | |
declare module 'express-session' { | |
interface SessionData { | |
[key: string]: any | |
} | |
} | |
const fileStore = sessionFileStore(expressSession) | |
app.use(expressSession({ | |
secret: 'this_should_be_your_secret', | |
resave: false, | |
saveUninitialized: true, | |
store: new fileStore(), | |
cookie: { | |
secure: false | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment