Skip to content

Commit 8d32a48

Browse files
committed
implemented EJS templating
1 parent ad6c0cb commit 8d32a48

File tree

5 files changed

+192
-4
lines changed

5 files changed

+192
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# FSL Test backend
2+
3+
### http://localhost:3000/

index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ const PORT = 3000;
33
const app = express();
44

55
app.use(express.json());
6+
app.set("view engine", "ejs");
67

78
app.get('/', async (req, res) => {
89
console.log("server given backshots");
9-
res.status(200).json({
10-
msg: "KYS"
11-
})
10+
res.render('index', {text: "kys"});
1211
});
1312

13+
console.log(`App listening on port ${PORT}`);
1414
app.listen(PORT);
15-

package-lock.json

Lines changed: 174 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"license": "ISC",
1010
"description": "",
1111
"dependencies": {
12+
"ejs": "^3.1.10",
1213
"express": "^4.19.2"
1314
}
1415
}

views/index.ejs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
KYS
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)