worker-time-control/proxy.js

18 lines
407 B
JavaScript
Raw Normal View History

2023-11-23 12:28:15 +00:00
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}`);
});