Skip to content

Commit 165df10

Browse files
committed
Use full word 'production'
Quotes changed to double for lesson consistency
1 parent 624a15d commit 165df10

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nodeJS/authentication/sessions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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";
8080
const app = express();
8181
app.set("views", path.join(__dirname, "views"));
8282
app.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
}));

0 commit comments

Comments
 (0)