change demo mode pdfs (#96)

This commit is contained in:
Shaheer Sarfaraz 2026-02-07 15:51:20 +00:00 committed by GitHub
parent cfabee5f45
commit a45cb0a724
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,7 @@ import cors from "cors";
import express from "express";
import { apiRouter } from "./api/index";
import { getDataDir } from "./config/dataDir";
import { isDemoMode } from "./config/demo";
const __dirname = dirname(fileURLToPath(import.meta.url));
@ -119,6 +120,14 @@ export function createApp() {
// Serve static files for generated PDFs
const pdfDir = join(getDataDir(), "pdfs");
if (isDemoMode()) {
const demoPdfPath = join(pdfDir, "demo.pdf");
app.get("/pdfs/*", (_req, res) => {
res.sendFile(demoPdfPath, (error) => {
if (error) res.status(404).end();
});
});
}
app.use("/pdfs", express.static(pdfDir));
// Health check