Skip to content

Commit

Permalink
Create cookieHandler.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Sstudiosdev authored Mar 21, 2024
1 parent b99680a commit a7319ba
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/cookieHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const cookieParser = require('cookie-parser');

function configureCookieParser(app) {
app.use(cookieParser());
}

function setLoggedInUserCookie(res, username, expires) {
res.cookie('loggedInUser', username, { expires: expires, httpOnly: true });
}

module.exports = {
configureCookieParser,
setLoggedInUserCookie
};

0 comments on commit a7319ba

Please sign in to comment.