const express = require("express"); const app = express(); const bodyP = require("body-parser"); const cors = require("cors"); const compiler = require("compilex"); const options = { stats: true }; compiler.init(options); app.use(express.json()); app.use(express.urlencoded({ extended: true })); app.use(cors()); app.use( "/codemirror-5.65.9", express.static("E:/websitesallprojects/CodeEditor/Compiler/codemirror-5.65.9") ); app.get("/", function (req, res) { compiler.flush(function () { console.log("deleted"); }); res.send("Hello World!!") }); app.post("/compile", function (req, res) { var code = req.body.code; var input = req.body.input; var lang = req.body.lang; console.log(code + " " + input + " " + lang); try { if (lang == "Cpp") { // Your existing code for compiling C++ } else if (lang == "Java") { // Your existing code for compiling Java } else if (lang == "Python") { // Your existing code for compiling Python } } catch (e) { console.log("error:" + e); } }); // Start the server const PORT = process.env.PORT || 7860; app.listen(PORT, () => { console.log(`Server is running on port ${PORT}`); });