hprasath commited on
Commit
b3c9671
·
verified ·
1 Parent(s): 41a4668

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +0 -35
index.js CHANGED
@@ -16,46 +16,11 @@ app.get("/", function (req, res) {
16
  res.send("Hello World!!");
17
  });
18
 
19
- // app.post("/compile", (req, res) => {
20
- // const { code, input } = req.body; // Assuming code and input are sent as POST parameters
21
-
22
- // // Write the Java code to Main.java file
23
- // fs.writeFile("/code/temp/Main.java", code, (err) => {
24
- // if (err) {
25
- // console.error(err);
26
- // res.status(500).send("Error writing Java file");
27
- // return;
28
- // }
29
-
30
- // // Compile and run the Java code with input
31
- // const javaProcess = exec(
32
- // "javac -d /code/temp /code/temp/Main.java && java -cp /code/temp Main",
33
- // (error, stdout, stderr) => {
34
- // if (error) {
35
- // console.error(error);
36
- // res.send({error:stderr});
37
- // return;
38
- // }
39
-
40
- // console.log(stdout);
41
- // console.error(stderr);
42
- // res.send({output:stdout});
43
- // }
44
- // );
45
-
46
- // // Pass input to the Java process
47
- // if (input) {
48
- // javaProcess.stdin.write(input);
49
- // javaProcess.stdin.end();
50
- // }
51
- // });
52
- // });
53
 
54
  app.post("/compile", function (req, res) {
55
  var code = req.body.code;
56
  var input = req.body.input;
57
  var lang = req.body.lang;
58
- console.log(code + " " + input + " " + lang);
59
 
60
  try {
61
  if (lang == "Python") {
 
16
  res.send("Hello World!!");
17
  });
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  app.post("/compile", function (req, res) {
21
  var code = req.body.code;
22
  var input = req.body.input;
23
  var lang = req.body.lang;
 
24
 
25
  try {
26
  if (lang == "Python") {