Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
@@ -16,7 +16,7 @@ app.get("/", function (req, res) {
|
|
16 |
res.send("Hello World!!");
|
17 |
});
|
18 |
|
19 |
-
const TIMEOUT_VALUE =
|
20 |
|
21 |
app.post("/compile", function (req, res) {
|
22 |
var code = req.body.code;
|
@@ -27,20 +27,20 @@ app.post("/compile", function (req, res) {
|
|
27 |
if (lang == "Python") {
|
28 |
if (!input) {
|
29 |
var envData = { OS: "linux" };
|
30 |
-
compiler.compilePython(envData, code,
|
31 |
if (data.output) {
|
32 |
res.send(data);
|
33 |
} else {
|
34 |
-
res.send({ error:
|
35 |
}
|
36 |
});
|
37 |
} else {
|
38 |
var envData = { OS: "linux" };
|
39 |
-
compiler.compilePythonWithInput(envData, code, input,
|
40 |
if (data.output) {
|
41 |
res.send(data);
|
42 |
} else {
|
43 |
-
res.send({ error:
|
44 |
}
|
45 |
});
|
46 |
}
|
|
|
16 |
res.send("Hello World!!");
|
17 |
});
|
18 |
|
19 |
+
const TIMEOUT_VALUE = 10000;
|
20 |
|
21 |
app.post("/compile", function (req, res) {
|
22 |
var code = req.body.code;
|
|
|
27 |
if (lang == "Python") {
|
28 |
if (!input) {
|
29 |
var envData = { OS: "linux" };
|
30 |
+
compiler.compilePython(envData, code, function (data) {
|
31 |
if (data.output) {
|
32 |
res.send(data);
|
33 |
} else {
|
34 |
+
res.send({ error: data.error });
|
35 |
}
|
36 |
});
|
37 |
} else {
|
38 |
var envData = { OS: "linux" };
|
39 |
+
compiler.compilePythonWithInput(envData, code, input, function (data) {
|
40 |
if (data.output) {
|
41 |
res.send(data);
|
42 |
} else {
|
43 |
+
res.send({ error: data.error });
|
44 |
}
|
45 |
});
|
46 |
}
|