sprinklers3/server/express/serveApp.ts

15 lines
368 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
import * as paths from "paths";
2017-09-07 12:26:23 -06:00
const index = path.join(paths.publicDir, "index.html");
export default function serveApp(app: Express) {
app.use(serveStatic(paths.appBuildDir));
2018-06-27 12:12:14 -06:00
app.get("/*", (req, res) => {
res.sendFile(index);
2018-06-27 12:12:14 -06:00
});
2017-09-07 12:26:23 -06:00
}