noteshare.space/proxy.example.js

26 lines
463 B
JavaScript
Raw Permalink Normal View History

const express = require("express");
const { createProxyMiddleware } = require("http-proxy-middleware");
const app = express();
2022-11-20 22:17:59 +03:00
const PORT = 5000;
app.use(
"/api/",
createProxyMiddleware({
target: "http://localhost:8080",
changeOrigin: true,
})
);
app.use(
"/",
createProxyMiddleware({
target: "http://localhost:5173",
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}`);