File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 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
1313- Describe what sessions are.
1414- Explain how sessions and cookies can be used together to persist logins.
1515- Implement authentication with sessions.
16- - Use a database as a session store.
1716- Explain how and why passwords are hashed before being stored.
1817
1918### Sessions
@@ -77,6 +76,7 @@ const pool = new Pool({
7776 // add your db configuration
7877});
7978
79+ const isProduction = process .env .NODE_ENV = " production" ;
8080const app = express ();
8181app .set (" views" , path .join (__dirname , " views" ));
8282app .set (" view engine" , " ejs" );
@@ -90,8 +90,8 @@ app.use(session({
9090 saveUninitialized: false ,
9191 secret: process .env .SESSION_SECRET ,
9292 cookie: {
93- httpOnly: process . env . NODE_ENV === ' prod ' ,
94- secure: process . env . NODE_ENV === ' prod ' ,
93+ httpOnly: isProduction ,
94+ secure: isProduction ,
9595 maxAge: 2 * 24 * 60 * 60 * 1000 , // 2 days
9696 },
9797}));
You can’t perform that action at this time.
0 commit comments