minor improvements

This commit is contained in:
Manish 2023-03-29 17:37:29 +11:00
parent c65f99f988
commit aa91c119d8

View File

@ -1,8 +1,10 @@
var express = require("express"); const express = require("express");
var cors = require("cors"); const cors = require("cors");
require("dotenv").config(); require("dotenv").config();
var app = express(); const PORT = process.env.PORT || 57268;
const app = express();
app.use(cors()); app.use(cors());
app.use("/public", express.static(process.cwd() + "/public")); app.use("/public", express.static(process.cwd() + "/public"));
@ -11,7 +13,10 @@ app.get("/", function (req, res) {
res.sendFile(process.cwd() + "/views/index.html"); res.sendFile(process.cwd() + "/views/index.html");
}); });
const port = process.env.PORT || 3000; app.post("/api/fileanalyse", (req, res) => {
app.listen(port, function () { res.json({ Hello: ", World!" });
console.log("Your app is listening on port " + port); });
app.listen(PORT, function () {
console.log("Your app is listening on port " + PORT);
}); });