Update to take port optionally from process.env.REACT_APP_PROXY_LOCALHOST_PORT; more explict mapping of all paths that javalin backend exposes

This commit is contained in:
2023-01-27 18:58:52 -06:00
parent 1b2512daa1
commit a343f76a3a

View File

@ -29,19 +29,27 @@ const {createProxyMiddleware} = require("http-proxy-middleware");
module.exports = function (app) module.exports = function (app)
{ {
app.use( let port = 8000;
"/data/*/export/*", if(process.env.REACT_APP_PROXY_LOCALHOST_PORT)
createProxyMiddleware({ {
target: "http://localhost:8000", port = process.env.REACT_APP_PROXY_LOCALHOST_PORT;
changeOrigin: true, }
}),
);
app.use( function getRequestHandler()
"/download/*", {
createProxyMiddleware({ return createProxyMiddleware({
target: "http://localhost:8000", target: `http://localhost:${port}`,
changeOrigin: true, changeOrigin: true,
}), });
); }
app.use("/data/*/export/*", getRequestHandler());
app.use("/download/*", getRequestHandler());
app.use("/metaData/*", getRequestHandler());
app.use("/data/*", getRequestHandler());
app.use("/widget/*", getRequestHandler());
app.use("/serverInfo", getRequestHandler());
app.use("/processes", getRequestHandler());
app.use("/reports", getRequestHandler());
}; };