Child Node.js process which you can proxy to.
npm install subnode
const express = require('express');
const subnode = require('subnode');
const api = subnode('./api/index');
const app = express();
app.use('/api', api.proxy);
app.get('/', (req, res, next) => {
res.send('Hello from 80');
});
app.listen(80);
const express = require('express');
const { NODE_PORT } = process.env;
const app = express();
app.set('trust proxy', true);
app.get('/', (req, res, next) => {
res.send(`Hello from ${NODE_PORT} to ${req.ip}`);
});
app.listen(NODE_PORT);
When you create "subnode", it gets forked with a random port number and included with NODE_PORT environment value.