|
@@ -1,4 +1,4 @@
|
|
|
-import express from "express";
|
|
|
+import express from "express";
|
|
|
import cors from "cors";
|
|
|
import helmet from "helmet";
|
|
|
import * as http from "http";
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
ErrorInterceptor,
|
|
|
} from "./interceptors";
|
|
|
import { getDirectories, generateCfgs } from "./utils";
|
|
|
+import * as path from "path";
|
|
|
|
|
|
const PLUGIN_DEV = process.env?.PLUGIN_DEV;
|
|
|
const SRC_PLUGIN_DIR = "src/plugins";
|
|
@@ -108,6 +109,14 @@ getDirectories(SRC_PLUGIN_DIR, async (dirErr: Error, dirRes: [string]) => {
|
|
|
app.use("/api/v1", router);
|
|
|
app.use("/api/plugins", pluginsRouter);
|
|
|
|
|
|
+ // Return client build files
|
|
|
+ app.use(express.static("build"));
|
|
|
+ // handle every other route with index.html, which will contain
|
|
|
+ // a script tag to your application's JavaScript file(s).
|
|
|
+ app.get("*", (request, response) => {
|
|
|
+ response.sendFile(path.join(__dirname, "../build/index.html"));
|
|
|
+ });
|
|
|
+
|
|
|
// ErrorInterceptor
|
|
|
app.use(ErrorInterceptor);
|
|
|
// start server
|