noteshare.space/proxy.example.js
Maxime Cannoodt 3fd77199fc update file
2022-12-03 09:42:54 +01:00

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}`);