Prepared for Garden
This commit is contained in:
parent
96ebe71cb6
commit
4bfe7bebc2
9 changed files with 45 additions and 67 deletions
|
@ -1,10 +1,21 @@
|
|||
const express = require("express");
|
||||
const { createProxyMiddleware: proxy } = require("http-proxy-middleware");
|
||||
const port = process.env.PORT ?? 52026;
|
||||
const cairoUrl = process.env.CAIRO_PUBLIC_URL;
|
||||
const nubianUrl = process.env.NUBIAN_INTERNAL_URL;
|
||||
const port = process.env.KHUFU_DEV_PORT ?? 52002;
|
||||
const { REACT_APP_CAIRO_URL, REACT_APP_NUBIAN_URL } = process.env;
|
||||
const cairoProxyOpt = {
|
||||
target: REACT_APP_CAIRO_URL,
|
||||
changeOrigin: true,
|
||||
pathRewrite: { "^/api/cairo": "/api" },
|
||||
};
|
||||
const nubianProxyOpt = {
|
||||
target: REACT_APP_NUBIAN_URL,
|
||||
changeOrigin: true,
|
||||
pathRewrite: { "^/api/nubian": "/api" },
|
||||
};
|
||||
const app = express();
|
||||
app.use("/", express.static("build"));
|
||||
app.use("/cairo", proxy({ target: cairoUrl, changeOrigin: true }));
|
||||
app.use("/nubian", proxy({ target: nubianUrl, changeOrigin: true }));
|
||||
app.listen(port, () => console.log(`🌴 Nile server started on ${port}! 🌴`));
|
||||
app.use("/api/cairo", proxy(cairoProxyOpt));
|
||||
app.use("/api/nubian", proxy(nubianProxyOpt));
|
||||
app.get("/healthcheck", (req, res) => res.sendStatus(200));
|
||||
app.get("/alive", (req, res) => res.sendStatus(200));
|
||||
app.listen(port, () => console.log(`🌴 Nile px server started on ${port}! 🌴`));
|
||||
|
|
Reference in a new issue