Add backend setup with Docker, Express, and error handling page

This commit is contained in:
2025-09-25 13:52:10 +02:00
parent 6eb40bb0ef
commit 77d51fd243
6 changed files with 207 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import express from "express";
import cors from "cors";
const app = express();
const port = 8002;
app.use(cors());
// Increase body size limits to support large CSV JSON payloads
app.use(express.urlencoded({ extended: true, limit: "10mb" }));
app.set("view engine", "ejs");
app.use(express.json({ limit: "10mb" }));
app.get("/", (req, res) => {
res.status(502).render("index.ejs");
});
app.listen(port, () => {
console.log(`Server is running on port: ${port}`);
});
// error handling code
app.use((err, req, res, next) => {
// Log the error stack and send a generic error response
console.error(err.stack);
res.status(500).send("Something broke!");
});