mirror of
https://github.com/len0rd/personal-website.git
synced 2026-01-20 08:40:44 -05:00
added basic contact page, fixed server and nav to handle it
This commit is contained in:
parent
350d6a6714
commit
8bf1fe07ba
3 changed files with 34 additions and 8 deletions
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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue