added backend files

This commit is contained in:
2026-01-27 19:59:13 +01:00
parent a1cd4191a5
commit a551bf6f6f
5 changed files with 263 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import express from "express";
import cors from "cors";
import apiRouter from "./routes/api.route.js";
const app = express();
const port = 9001;
@@ -11,9 +12,10 @@ app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});
app.use("/api", apiRouter);
// error handling code
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).send("Something broke!");
});
});