-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·67 lines (61 loc) · 1.43 KB
/
index.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
const express = require("express");
const path = require('path');
const app = express();
var BSearch2 = `def play_game():
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
while is_happy:
jump_up_and_down
`
// Bsearch2 = Bsearch2.replace(/(\n)+/g, '<br />');
var BSearch = `function bsearch (Arr,value){<br>var low = 0,
high = Arr.length - 1,
mid;
while (low <= high) {
mid = Math.floor((low + high) / 2);
if (Arr[mid] == value) return mid;
else if (Arr[mid] < value) low = mid + 1;
else high = mid - 1;
}
return -1;
}`
app.use(express.static(path.join(__dirname, 'client')));
app.get('/express_backend', (req, res) => {
res.send({
express: BSearch2
});
});
app.get("/", (req, res) => {
res.send({ status: 'Hello World' });
});
const server = app.listen(process.env.PORT || 8080, () => {
const host = server.address().address;
const port = server.address().port;
console.log(`Example app listening at http://${host}:${port}`);
});