Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nodejs_tutorial
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jameschiu
nodejs_tutorial
Commits
d089dc25
Commit
d089dc25
authored
May 25, 2022
by
james
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] 更新說明
parent
eedab674
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
index.js
index.js
+5
-7
views/pages/about.ejs
views/pages/about.ejs
+28
-0
views/pages/index.ejs
views/pages/index.ejs
+1
-1
No files found.
index.js
View file @
d089dc25
var
express
=
require
(
'
express
'
);
var
app
=
express
();
//
set the view engine to ejs
//
設定模板引擎 EJS
app
.
set
(
'
view engine
'
,
'
ejs
'
);
// use res.render to load up an ejs view file
// index page
// 首頁
app
.
get
(
'
/
'
,
function
(
req
,
res
)
{
res
.
render
(
'
pages/index
'
);
res
.
render
(
'
pages/index
'
,{
title
:
'
首頁
'
}
);
});
//
about page
//
關於
app
.
get
(
'
/about
'
,
function
(
req
,
res
)
{
res
.
render
(
'
pages/about
'
);
res
.
render
(
'
pages/about
'
,{
title
:
'
關於
'
}
);
});
app
.
listen
(
8080
);
...
...
views/pages/about.ejs
0 → 100644
View file @
d089dc25
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<
%
-
include
('../
partials
/
head
');
%
>
</head>
<body
class=
"container"
>
<header>
<
%
-
include
('../
partials
/
header
');
%
>
</header>
<main>
<div
class=
"row"
>
<div
class=
"col-sm-8"
>
<div
class=
"jumbotron"
>
<h1><
%=
title
%
></h1>
<p>
Welcome to templating using EJS
</p>
</div>
</div>
</div>
</main>
<footer>
<
%
-
include
('../
partials
/
footer
');
%
>
</footer>
</body>
</html>
\ No newline at end of file
views/pages/index.ejs
View file @
d089dc25
...
...
@@ -11,7 +11,7 @@
<main>
<div
class=
"jumbotron"
>
<h1>
Hello World!
</h1>
<h1>
<
%=
title
%
>
</h1>
<p>
Welcome to templating using EJS
</p>
</div>
</main>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment