-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc.js
79 lines (65 loc) · 1.77 KB
/
c.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// rough work
// // const fd = require("fs");
// // function s(err, data) {
// // console.log(data);
// // }
// // fd.readFile("a.txt", "utf-8", s);
const express = require("express");
const app = express();
const port = 3001;
function abn(stc) {
if (stc < 100) {
console.log("number is less than 100");
} else {
console.log("given number is heigher than 100");
}
return stc;
}
//console.log(abn(122));
function first(req, res) {
var cot = req.query.abnn;
let ans = abn(parseInt(cot));
console.log("the answer is : " + ans);
res.send(
`ok the given number is ${ans} ,${
ans < 100
? "given number is less than 100"
: "given number heiger than 100"
}`
);
}
// function first(req, res) {
// var cot = req.query.abnn;
// let ans = abn(parseInt(cot));
// console.log("the answer is: " + ans);
// res.send(
// `ok the given number is ${ans}, ${ans < 100? "given number is less than 100": "given number is higher than 100"}`
// );
// }
app.get("/first", first);
function started() {
console.log(`Example app listening on port ${port}`);
}
app.listen(port, started);
// const express = require("express");
// const app = express();
// const port = 3001;
// function abn(stc) {
// if (stc < 100) {
// console.log("number is less than 100");
// } else {
// console.log("given number is higher than 100");
// }
// return stc;
// }
// function first(req, res) {
// var cot = req.query.abnn;
// let ans = abn(parseInt(cot));
// console.log("the answer is: " + ans);
// res.send("ok");
// }
// app.get("/first", first);
// function started() {
// console.log(`Example app listening on port ${port}`);
// }
// app.listen(port, started);