Skip to content

Commit

Permalink
add ejs partial for shared header across pages
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinZYen committed Sep 29, 2024
1 parent 58e5c48 commit a232720
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 41 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var cookieParser = require('cookie-parser');
var logger = require('morgan');

var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var contactRouter = require('./routes/contact');

var app = express();

Expand All @@ -20,7 +20,7 @@ app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/users', usersRouter);
app.use('/contact', contactRouter);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
Expand Down
2 changes: 1 addition & 1 deletion routes/users.js → routes/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var router = express.Router();

/* GET users listing. */
router.get('/', function(req, res, next) {
res.send('respond with a resource');
res.render("contact");
});

module.exports = router;
33 changes: 0 additions & 33 deletions src/index.html

This file was deleted.

10 changes: 10 additions & 0 deletions views/contact.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>

</head>
<body>
<%- include("nav-bar")%>
Contact Page!!!
</body>
</html>
6 changes: 1 addition & 5 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
<link rel="stylesheet" href="/stylesheets/page.css">
</head>
<body>
<div id="nav-bar">
<a href="https://github.com/JustinZYen">Github</a>
<a href="https://www.linkedin.com/in/justin-yen-77a2a52a5/">LinkedIn</a>
<a>Contact Me (doesn't work)</a>
</div>
<%- include("nav-bar")%>
<div id="title-page">
<h1>Justin Yen</h1>
<h2>Computer Science Student at ASU's Barrett, the Honors College</h2>
Expand Down
6 changes: 6 additions & 0 deletions views/nav-bar.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div id="nav-bar">
<a href="./">Home</a>
<a href="https://github.com/JustinZYen">Github</a>
<a href="https://www.linkedin.com/in/justin-yen-77a2a52a5/">LinkedIn</a>
<a href="./contact">Contact Me (doesn't work)</a>
</div>

0 comments on commit a232720

Please sign in to comment.