-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver3.js
More file actions
39 lines (32 loc) · 797 Bytes
/
Copy pathserver3.js
File metadata and controls
39 lines (32 loc) · 797 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
import express from "express";
const app=express();
const port=3003;
app.use(express.json());
app.get("/health",(req,res)=>{
res.json({
healthy:true
});
})
app.get("/:key",(req,res)=>{
const key=req.params.key;
console.log(key);
res.send("You're talking to server 3");
})
app.post("/:key",(req,res)=>{
const key=req.params.key;
console.log("Post ",key);
res.send("You're talking to server 3");
})
app.patch("/:key",(req,res)=>{
const key=req.params.key;
console.log("Patch ",key);
res.send("You're talking to server 3");
})
app.delete("/:key",(req,res)=>{
const key=req.params.key;
console.log("Delete ",key);
res.send("You're talking to server 3");
})
app.listen(port,()=>{
console.log("Server running on port ",port);
})