Open ericclemmons opened 5 years ago
This seems necessary, mainly because of the need to rewrite URLs:
With that said, the support for package.json
could be an option.
polydev
is the one starting processes, not the route. So the route doesn't know what the PORT
is. (Or does it!?)async
route to do the install (maybe not with execSync
, but we need req.params
).PORT
is that the route is already listening on that port, so starting a new server needs guessing another port. (1${PORT}
? )Here's a potential solution:
module.exports = (req, res) => {
const { branch } req.params
if (!started) {
execSync(...allTheThings)
require('./path/to/branch/server') // PORT should be set!
}
return httpProxyMiddleware(...)
}
Here's a crazy idea:
/routes/branch/:name
module.exports = async () => ...
tmp
folder.return require(tmp)
In theory, this could work!
There would need to be a ~5 minute or ~10 minute timer to kill lambdas, but that's easy.