26 lines
463 B
JavaScript
26 lines
463 B
JavaScript
const express = require("express");
|
|
const { createProxyMiddleware } = require("http-proxy-middleware");
|
|
|
|
const app = express();
|
|
|
|
const PORT = 5000;
|
|
|
|
app.use(
|
|
"/api/",
|
|
createProxyMiddleware({
|
|
target: "http://localhost:8080",
|
|
changeOrigin: true,
|
|
})
|
|
);
|
|
|
|
app.use(
|
|
"/",
|
|
createProxyMiddleware({
|
|
target: "http://localhost:5173",
|
|
changeOrigin: true,
|
|
})
|
|
);
|
|
|
|
app.listen(PORT);
|
|
console.log(`Reverse proxy listening at http://localhost:${PORT}`);
|