mirror of
https://github.com/len0rd/personal-website.git
synced 2025-03-01 03:51:57 -05:00
added basic contact page, fixed server and nav to handle it
This commit is contained in:
parent
350d6a6714
commit
8bf1fe07ba
17
server.js
17
server.js
|
@ -6,13 +6,18 @@ console.log('Hello');
|
|||
// set the view engine to ejs
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
// use res.render to load an ejs view file
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
res.render('pages/index');
|
||||
});
|
||||
|
||||
// add folder for static content:
|
||||
app.use(express.static(__dirname + '/assets'));
|
||||
|
||||
app.get(/\/.*/, function(req, res) {
|
||||
console.log(req.path);
|
||||
let pathname = 'pages' + req.path;
|
||||
|
||||
if ((pathname)[pathname.length - 1] === '/') {
|
||||
pathname += 'index';
|
||||
}
|
||||
|
||||
res.render(pathname);
|
||||
});
|
||||
|
||||
app.listen(8090);
|
21
views/pages/contact.ejs
Normal file
21
views/pages/contact.ejs
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<% include ../partials/include %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<% include ../partials/nav %>
|
||||
<div class="container center">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<h1>Contact me</h1>
|
||||
<p>As a lonly explorer of the interwebs, I welcome the warm embrace of human contact. Please email me with the below address:</p>
|
||||
<h2>contact@lenord.me</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +1,7 @@
|
|||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
|
||||
<div class="container">
|
||||
|
||||
<a class="navbar-brand" href="#">lenordsNet</a>
|
||||
<a class="navbar-brand" href="/#">lenordsNet</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
|
@ -15,7 +15,7 @@
|
|||
<a class="nav-link" href="http://www.blog.lenords.net">Blog</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a href="#" class="btn btn-outline-light my-2 my-sm-0">Contact</a>
|
||||
<a href="/contact" class="btn btn-outline-light my-2 my-sm-0">Contact</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
Loading…
Reference in a new issue