added basic contact page, fixed server and nav to handle it

This commit is contained in:
len0rd 2018-07-27 13:32:34 -04:00
parent 350d6a6714
commit 8bf1fe07ba
3 changed files with 34 additions and 8 deletions

View file

@ -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);