2023-11-23 12:28:15 +00:00
|
|
|
const express = require('express');
|
2023-12-07 14:23:02 +00:00
|
|
|
const dotenv = require('dotenv');
|
2023-11-23 12:28:15 +00:00
|
|
|
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
|
|
|
|
|
|
const app = express();
|
2023-12-07 14:23:02 +00:00
|
|
|
dotenv.config();
|
2023-11-23 12:28:15 +00:00
|
|
|
const apiProxy = createProxyMiddleware('/api', {
|
2023-12-07 14:23:02 +00:00
|
|
|
target: process.env.TARGET,
|
2023-11-23 12:28:15 +00:00
|
|
|
changeOrigin: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
app.use('/api', apiProxy);
|
|
|
|
app.use('/', express.static(__dirname));
|
|
|
|
|
|
|
|
const port = 4000;
|
|
|
|
app.listen(port, () => {
|
|
|
|
console.log(`Server running on port: ${port}`);
|
|
|
|
});
|