sprinklers3/server/express/serveApp.ts

15 lines
376 B
TypeScript

import { Express } from "express";
import * as path from "path";
import * as serveStatic from "serve-static";
import * as paths from "@common/paths";
const index = path.join(paths.publicDir, "index.html");
export default function serveApp(app: Express) {
app.use(serveStatic(paths.appBuildDir));
app.get("/*", (req, res) => {
res.sendFile(index);
});
}