Skip to content

Instantly share code, notes, and snippets.

@styks1987
Created September 19, 2018 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save styks1987/e29f719c542f2ee9536f3c3bdaad7688 to your computer and use it in GitHub Desktop.
Save styks1987/e29f719c542f2ee9536f3c3bdaad7688 to your computer and use it in GitHub Desktop.
const net = require('net');
export default () => {
return new Promise(resolve => {
const server = net.createServer();
server.listen(() => {
console.log('callback');
});
console.log(server.address().port);
server.on('error', err => {
throw err;
});
resolve(server); // I don't want this here. I want it in the listen function
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment