-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimag.js
64 lines (38 loc) · 1.06 KB
/
imag.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var express = require('express')
var app = express();
app.use(express.static('images'))
app.get('/',function(req,res)
{
res.send(`
<html>
<body>
<form action = '/home' method = get />
enter age : <input type = "text" name = "age" >
<input type = "submit" value = "submit" >
</body>
</html>
`)
})
app.get('/home',function(req,res)
{
if(req.query.age <= 25)
{
res.send(`<img src = "boy-128.png" >`)
}
else if((req.query.age >= 26) && (req.query.age<50))
{
res.send(`<img src = "male3-128.png" >`)
}
else if((req.query.age >= 50) && (req.query.age <=100))
{
res.send(`<img src = "matureman2-128.png" >`)
}
else
{
res.send("invalid age");
}
})
app.listen(1234,function ()
{
console.log("hy");
})