Skip to content

Instantly share code, notes, and snippets.

@gensart-x
Created June 7, 2024 09:04
Show Gist options
  • Save gensart-x/78159197bcaae3b411cf9f2e4d5f596f to your computer and use it in GitHub Desktop.
Save gensart-x/78159197bcaae3b411cf9f2e4d5f596f to your computer and use it in GitHub Desktop.
Session setup, filesystem-based, Express Session for Node.js
// 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