Closed
Description
Node's Server#listen()
method accepts a fd
option and I am wondering if hapi could support something like that.
The reason this would be useful to me is that I want to use substack's tcp-bind and sindresorhus' root-check to drop privileges as soon as possible.
As a simplified example, I wish something like this worked when run with sudo
:
const fd = require('tcp-bind')(80);
require('root-check')();
const { Server } = require('hapi'),
const server = new Server();
server.connection({ fd });
server.start((err) => {
if (err) {
throw err;
}
console.log('Server is ready.');
});
The benefit here is that I can drop privileges as soon as possible, without waiting for the start
callback, etc.