-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·48 lines (33 loc) · 786 Bytes
/
server.js
File metadata and controls
executable file
·48 lines (33 loc) · 786 Bytes
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
const s = require("express");
const hbs = require("hbs");
const port = process.env.PORT || 3000;
var app = s();
app.set("view engine", "hbs");
app.use(s.static(__dirname + '/public'));
app.get("/", (req, res) => {
//res.send("Hello express");
res.render("home.hbs", {
project_name: "Blockchain"
});
});
app.get("/users", (req, res) => {
res.send({
title: "Go to dentist",
completed: false
});
});
app.post("/todos", (req, res) => {
//console.log(req);
res.send("Saved to database");
});
app.get("/about", (req, res) => {
//res.send("About page ... ");
res.render("about.hbs", {
username: "Vikas",
age: 31,
address: "17042 Aggarwal Colony Bathinda"
});
});
app.listen(port, () => {
console.log(`Server is up at ${port}`);
});