sprinklers3/server/express/serveApp.ts

16 lines
405 B
TypeScript
Raw Normal View History

import { Express } from "express";
import * as path from "path";
import * as serveStatic from "serve-static";
2017-09-07 12:26:23 -06:00
2018-08-31 21:59:06 -06:00
// tslint:disable-next-line:no-var-requires
const paths = require("paths");
2017-09-07 12:26:23 -06:00
const index = path.join(paths.publicDir, "index.html");
export default function serveApp(app: Express) {
2018-09-02 02:57:55 -06:00
app.use(serveStatic(paths.clientBuildDir));
app.get("/*", (req, res) => {
res.sendFile(index);
});
2017-09-07 12:26:23 -06:00
}