worker-time-control/proxy.js

19 lines
452 B
JavaScript

const express = require('express');
const dotenv = require('dotenv');
const { createProxyMiddleware } = require('http-proxy-middleware');
const app = express();
dotenv.config();
const apiProxy = createProxyMiddleware('/api', {
target: process.env.TARGET,
changeOrigin: true,
});
app.use('/api', apiProxy);
app.use('/', express.static(__dirname));
const port = 4000;
app.listen(port, () => {
console.log(`Server running on port: ${port}`);
});