File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ This section contains a general overview of topics that you will learn in this l
13
13
- Describe what sessions are.
14
14
- Explain how sessions and cookies can be used together to persist logins.
15
15
- Implement authentication with sessions.
16
- - Use a database as a session store.
17
16
- Explain how and why passwords are hashed before being stored.
18
17
19
18
### Sessions
@@ -77,6 +76,7 @@ const pool = new Pool({
77
76
// add your db configuration
78
77
});
79
78
79
+ const isProduction = process .env .NODE_ENV === " production" ;
80
80
const app = express ();
81
81
app .set (" views" , path .join (__dirname , " views" ));
82
82
app .set (" view engine" , " ejs" );
@@ -90,8 +90,8 @@ app.use(session({
90
90
saveUninitialized: false ,
91
91
secret: process .env .SESSION_SECRET ,
92
92
cookie: {
93
- httpOnly: process . env . NODE_ENV === ' prod ' ,
94
- secure: process . env . NODE_ENV === ' prod ' ,
93
+ httpOnly: isProduction ,
94
+ secure: isProduction ,
95
95
maxAge: 2 * 24 * 60 * 60 * 1000 , // 2 days
96
96
},
97
97
}));
You can’t perform that action at this time.
0 commit comments