refactor: RAPPORT-HOST ist jetzt reines Backend
Das Frontend (Marketing + Login/Konto) ist in RAPPORT-WEBSITE umgezogen (Hugo + Vanilla-JS). RAPPORT-HOST liefert dessen gebautes public/ statisch aus und stellt /api bereit. - server/index.js: serviert RAPPORT-WEBSITE/public + /api (eine Origin) - server/env.js: websitePublicDir (WEBSITE_PUBLIC_DIR, Default Schwester-Repo); PUBLIC_BASE_URL Default auf einheitliche Origin :8787 - billing.js: Checkout-Redirects auf /konto/ bzw. /hosting-preise/ - entfernt: src/ (React), marketing/ (Hugo-Kopie), index.html, vite.config.js - package.json: nur noch server/migrate/build:website-Scripts E2E verifiziert: /, /hosting/, /login/, /konto/, /js + Font = 200; register→checkout(mock)→Instanz; Redirect → /konto/?provisioned=1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+12
-4
@@ -21,12 +21,20 @@ app.use("/api/auth", authRouter);
|
||||
app.use("/api/billing", billingRouter);
|
||||
app.use("/api/account", accountRouter);
|
||||
|
||||
// In Produktion liefert dasselbe Backend das gebaute Frontend aus (dist/).
|
||||
const dist = path.resolve(__dirname, "..", "dist");
|
||||
app.use(express.static(dist));
|
||||
// ── Statische Auslieferung der RAPPORT-WEBSITE (Hugo-Build) ──────────────────
|
||||
// Die komplette Frontend-Oberfläche (Marketing + Hosting + Login/Konto als
|
||||
// Vanilla-JS-Seiten) kommt aus dem AGPL-Repo RAPPORT-WEBSITE. Dieses Backend
|
||||
// liefert dessen gebautes public/ aus und stellt darunter /api bereit.
|
||||
// Saubere Trennung: die Website enthält keinen Backend-Code, nur fetch('/api').
|
||||
// Pfad per WEBSITE_PUBLIC_DIR überschreibbar (Default: Schwester-Repo).
|
||||
const websitePublic = env.websitePublicDir;
|
||||
|
||||
app.use(express.static(websitePublic));
|
||||
app.get("*", (req, res, next) => {
|
||||
if (req.path.startsWith("/api/")) return next();
|
||||
res.sendFile(path.join(dist, "index.html"), (err) => err && next());
|
||||
// Hugo erzeugt pro Seite eine eigene index.html → Clean-URLs funktionieren
|
||||
// direkt über express.static. Unbekannte Pfade → 404-Seite.
|
||||
res.status(404).sendFile(path.join(websitePublic, "404.html"), (err) => err && next());
|
||||
});
|
||||
|
||||
// Express-Fehlerhandler: fängt synchron geworfene Fehler aus Routen → 500
|
||||
|
||||
Reference in New Issue
Block a user