-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiddleware.js
More file actions
36 lines (31 loc) · 792 Bytes
/
middleware.js
File metadata and controls
36 lines (31 loc) · 792 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
const express = require("express");
const app = express()
const port = 3000
function usermiddleware(req,res,next){
if(username!="nithin" || pasword!="pass"){
res.status(400).json({
msg:"User not found",
})
}else{
next();
}
};
function kidneymiddleware(req,res,next){
if(kidnyeid !=1 && kidneyid != 2){
res.status.json({
msg:"Kidney count invalid",
})
}else{
next();
}
};
app.use(calcaulaterequests)
app.get("/health-checkup",usermiddleware,kidneymiddleware,(req,res)=>{
app.send("your heart is healthy");
});
app.get("/health-checkup",(req,res)=>{
res.send("your heart is healthy");
});
app.get("/health-checkup",usermiddleware,(req,res)=>{
res.send("your heart is healthy");
})