-
Notifications
You must be signed in to change notification settings - Fork 0
/
Assignment_03.js
45 lines (37 loc) · 1.09 KB
/
Assignment_03.js
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
const express=require('express');
const hbs=require('hbs');
var app=express();
var port=process.env.PORT || 2002;
app.use(express.static(__dirname+'/public'));
app.set('view engine','hbs');
hbs.registerPartials(__dirname+'/views/partials');
hbs.registerHelper('getCurrentYear',()=>{
return new Date().getFullYear()
})
app.get('/',(req,res) => {
res.render('home.hbs',{
pageTitle:'Home Page',
yr: new Date().getFullYear()
});
});
app.get('/contact',(req,res) => {
res.render('contact.hbs',{
pageTitle:'Contact Us',
yr: new Date().getFullYear()
});
});
app.get('/ceo',(req,res) => {
res.render('ceo.hbs',{
pageTitle:'CEO',
yr: new Date().getFullYear()
});
});
app.get('/about',(req,res) => {
res.render('about.hbs',{
pageTitle:'About'
});
});
app.listen(port,()=>
{
console.log("running s")
});