Skip to content

Commit

Permalink
Don't save sessions in db if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
YasharF committed Feb 1, 2025
1 parent e42d0f5 commit ab6e6db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(limiter);
app.use(session({
resave: true,
saveUninitialized: true,
resave: true, // Only save session if modified
saveUninitialized: false, // Do not save sessions until we have something to store
secret: process.env.SESSION_SECRET,
name: 'startercookie', // change the cookie name for additional security in production
cookie: {
Expand Down

0 comments on commit ab6e6db

Please sign in to comment.