noteshare.space/proxy.example.js

26 lines
463 B
JavaScript
Raw 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);
console.log(`Reverse proxy listening at http://localhost:${5000}`);