2017-09-08 10:36:10 -06:00
|
|
|
import { Express } from "express";
|
2018-06-27 14:46:03 -06:00
|
|
|
import * as path from "path";
|
2017-10-03 13:07:05 -06:00
|
|
|
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
|
|
|
|
2018-06-27 14:46:03 -06:00
|
|
|
const index = path.join(paths.publicDir, "index.html");
|
|
|
|
|
2017-09-08 10:36:10 -06:00
|
|
|
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
|
|
|
}
|