-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
50 lines (39 loc) · 1.35 KB
/
server.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
46
47
48
49
50
const express = require('express')
const app = express()
const router = express.Router()
// set view engine ejs
app.set('view engine', 'ejs')
app.get('/', function (req, res) {
// let mascot = [
// { name: 'sammy', organization: 'digital ocean', birth: 2011 },
// { name: 'turu', organization: 'digital lib', birth: 2000 },
// { name: 'pari', organization: 'digital farmer', birth: 2007 }
// ]
// let tagline = "no programing concept is complet without a cute animal mascot";
// let title = "main page"
let data = {
mascot: [
{ name: 'sammy', organization: 'digital ocean', birth: 2011 },
{ name: 'turu', organization: 'digital lib', birth: 2000 },
{ name: 'pari', organization: 'digital farmer', birth: 2007 }
],
tagline: "no programing concept is complet without a cute animal mascot",
title: "main page"
}
res.render('pages/index', { data: data })
})
app.get('/about', function (req, res) {
let data = {
title: "About page"
}
res.render('pages/about', { data: data })
})
app.get('/boots', function (req, res) {
let data = {
title: 'halaman tampil',
content: 'pages/isi'
}
res.render('layouts/wrapper', { data: data })
})
app.listen(3000);
console.log('server is runing on http://localhost:3000')