-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHi.js
More file actions
18 lines (15 loc) · 648 Bytes
/
Hi.js
File metadata and controls
18 lines (15 loc) · 648 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export default function hello(app) {
function sayHello(req, res) {
res.send("Hello World");
}
function lifeIsGood(req, res) {
res.send("Life is Good!!!")
}
function rootResponse(req, res) {
res.send("Welcome to Node.js HTTP Restart");
}
app.get('/hello', sayHello); //if the server received a request, /hello, we will send "Hello World"
// when try to run it, type "node App.js", then try http://localhost:4000/hello
app.get("/", rootResponse); // ctrl + c to stop the server and type "node App.js" again
app.get("/good", lifeIsGood) // use "nodemon App.js" don't need restart it
}