feat: Docker Compose support
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import express, { type Express } from "express";
|
||||
import cors from "cors";
|
||||
import { existsSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import pinoHttp from "pino-http";
|
||||
import session from "express-session";
|
||||
import ConnectPgSimple from "connect-pg-simple";
|
||||
@@ -58,4 +60,13 @@ app.use(
|
||||
|
||||
app.use("/api", router);
|
||||
|
||||
const staticDir = process.env.STATIC_DIR;
|
||||
if (staticDir && existsSync(staticDir)) {
|
||||
app.use(express.static(staticDir));
|
||||
app.get("*", (_req, res) => {
|
||||
res.sendFile(resolve(staticDir, "index.html"));
|
||||
});
|
||||
logger.info({ staticDir }, "Serving static files");
|
||||
}
|
||||
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user