Umbau auf Alpine.js
This commit is contained in:
@@ -10,7 +10,7 @@ const absencesRouter = require("./routes/absences");
|
||||
const capacityRouter = require("./routes/capacity");
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
@@ -23,13 +23,14 @@ app.use("/api/tasks", tasksRouter);
|
||||
app.use("/api/absences", absencesRouter);
|
||||
app.use("/api/capacity", capacityRouter);
|
||||
|
||||
// Gebautes Frontend (Vite -> dist) ausliefern
|
||||
const frontendDist = path.join(__dirname, "..", "public");
|
||||
app.use(express.static(frontendDist));
|
||||
// Statisches Frontend (HTML/CSS/JS, kein Build-Step) aus dem
|
||||
// Geschwisterverzeichnis "frontend" ausliefern
|
||||
const frontendDir = path.join(__dirname, "..", "..", "frontend");
|
||||
app.use(express.static(frontendDir));
|
||||
|
||||
// SPA-Fallback: alles, was nicht /api ist, liefert die index.html aus
|
||||
// Fallback: alles, was nicht /api ist, liefert die index.html aus
|
||||
app.get(/^(?!\/api).*/, (req, res) => {
|
||||
res.sendFile(path.join(frontendDist, "index.html"));
|
||||
res.sendFile(path.join(frontendDir, "index.html"));
|
||||
});
|
||||
|
||||
app.use((err, req, res, next) => {
|
||||
|
||||
Reference in New Issue
Block a user