Proxy with on-demand server launching
npm i proxytin
a.js
const express = require('express');
const { listen } = require('proxytin');
const app = express();
app.get('/', (req, res, next) => {
res.send('Hello from a');
});
listen(app, (err, port) => {
if (err) {
throw new Error(err);
}
console.log(`Listening to ${port}`);
});
proxy.js
const { proxyTo } = require('proxytin');
const express = require('express');
const app = express();
app.get('/a', proxyTo('./a.js'));
app.listen(80);