-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
52 lines (47 loc) · 1.03 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Dev Myrepo app</title>
<link href="_styles/laa-styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="page-wrap">
<header>
</header>
<nav>
<ul>
<li>Home</li>
<li>Project</li>
<li>Contact</li>
<li>Signin</li>
<li>Signup</li>
</ul>
</nav>
<main>
</main>
<footer>
<a href="">contact</a>
</footer>
</div>
<script src="_scripts/ufn.js"></script>
<script type="text/javascript">
function requireRole (role) {
return function (req, res, next) {
if (req.session.user && req.session.user.role === role) {
next();
} else {
res.send(403);
}
}
}
app.get("/foo", foo.index);
app.get("/foo/:id", requireRole("user"), foo.show);
app.post("/foo", requireRole("admin"), foo.create);
// All bars are protected
app.all("/foo/bar", requireRole("admin"));
// All paths starting with "/foo/bar/" are protected
app.all("/foo/bar/*", requireRole("user"));
</script>
</body>
</html>