2022-07-03 16:24:27 +03:00
|
|
|
const express = require("express");
|
|
|
|
const { createProxyMiddleware } = require("http-proxy-middleware");
|
|
|
|
|
|
|
|
const app = express();
|
|
|
|
|
2022-11-20 22:17:59 +03:00
|
|
|
const PORT = 5000;
|
|
|
|
|
2022-07-03 16:24:27 +03:00
|
|
|
app.use(
|
|
|
|
"/api/",
|
|
|
|
createProxyMiddleware({
|
|
|
|
target: "http://localhost:8080",
|
|
|
|
changeOrigin: true,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
app.use(
|
|
|
|
"/",
|
|
|
|
createProxyMiddleware({
|
2022-11-13 16:16:28 +03:00
|
|
|
target: "http://localhost:5173",
|
2022-07-03 16:24:27 +03:00
|
|
|
changeOrigin: true,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
2022-11-20 22:17:59 +03:00
|
|
|
app.listen(PORT);
|
2022-12-03 11:42:54 +03:00
|
|
|
console.log(`Reverse proxy listening at http://localhost:${PORT}`);
|