worker-time-control/proxy.js

18 lines
407 B
JavaScript

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