hprasath commited on
Commit
00320d3
1 Parent(s): ec9aad1

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +5 -5
index.js CHANGED
@@ -16,7 +16,7 @@ app.get("/", function (req, res) {
16
  res.send("Hello World!!");
17
  });
18
 
19
- const TIMEOUT_VALUE = 5000;
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, { timeout: TIMEOUT_VALUE }, function (data) {
31
  if (data.output) {
32
  res.send(data);
33
  } else {
34
- res.send({ error: "Time Limit Exceeded!!" });
35
  }
36
  });
37
  } else {
38
  var envData = { OS: "linux" };
39
- compiler.compilePythonWithInput(envData, code, input, { timeout: TIMEOUT_VALUE }, function (data) {
40
  if (data.output) {
41
  res.send(data);
42
  } else {
43
- res.send({ error: "Time Limit Exceeded!!" });
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
  }