async-listen
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

async-listen

Promisify server.listen for your HTTP/HTTPS/TCP server.

Install

npm install async-listen

Usage

import listen from 'async-listen';
import { createServer } from 'http';

async function main() {
	const port = 3000;
	const server = createServer();
	const address = await listen(server, port);
	console.log(address); // => URL('http://127.0.0.1:3000')
}

main().catch(console.error);

Package Sidebar

Install

npm i async-listen

Weekly Downloads

1,332,542

Version

3.0.1

License

MIT

Unpacked Size

11.3 kB

Total Files

6

Last publish

Collaborators

  • tootallnate
  • ethan_arrowood
  • vercel-release-bot