Chapter 9: Authenticating with Express.js

This commit is contained in:
Beth Griggs 2020-09-05 22:27:25 +01:00
parent cc55d0dfe1
commit 61e61007b8
No known key found for this signature in database
GPG Key ID: D7062848A1AB005C
2 changed files with 5 additions and 5 deletions

View File

@ -4,8 +4,8 @@ const router = Router();
router.get("/", function (req, res) {
const title = "Express";
const user = req.session.user;
res.render("index", { title, user });
res.render("index", { user });
});
module.exports = router;
module.exports = router;

View File

@ -1,10 +1,10 @@
<html>
<head>
<title> <%= title %> </title>
<title> Express </title>
</head>
<body>
<h1> <%= title %> </h1>
<p> Welcome to <%= title %> </p>
<h1> Express </h1>
<p> Welcome to Express </p>
<% if (user) { %>
<p> Hello <%= user.name %>! </p>
<p> <a href=/auth/logout> Logout </a> </p>