const port = process.env.PORT_TO_BACKEND;

const { createProxyMiddleware } = require("http-proxy-middleware");
module.exports = function (app) {
	app.use(
		"/api/",
		createProxyMiddleware({
			target: `http://localhost:${port}/api/`,
			changeOrigin: true,
			pathRewrite: { "^/api": "/", // remove base path
			},
		})
	);
};
