28. 建立 index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Jade</title>
</head>
<body>
<h1>Jade - node template engine</h1>
<div id="container" class="col">
<p>You are amazing</p>
<p>Jade is a terse and simple
templating language with a
strong focus on performance
and powerful features.</p>
</div>
</body>
</html>
33. 建立 views/index.jade
doctype html
html(lang='en')
head
title Jade
body
h1 Jade - node template engine (#{title})
#container.col
pYou are amazing
p
| Jade is a terse and simple
| templating language with a
| strong focus on performance
| and powerful features.
34. 更更新 app.js
const express = require('express');
const app = express();
const http = require('http');
const port = 3000;
const index = require(‘./controllers/index');
app.use('/', index);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
http.createServer(app)
.listen(port, function() {
console.log('App listening on port ' + port + '!'); // Server 啟動後吐回⽬目前的 PORT 碼
});