node-agent-base/async-listen
zhouganqing c36ffc8542 Import Upstream version 6.0.2+~cs5.4.2 2023-02-17 11:10:55 +08:00
..
dist/src Import Upstream version 6.0.2+~cs5.4.2 2023-02-17 11:10:55 +08:00
Readme.md Import Upstream version 6.0.2+~cs5.4.2 2023-02-17 11:10:55 +08:00
package.json Import Upstream version 6.0.2+~cs5.4.2 2023-02-17 11:10:55 +08:00

Readme.md

async-listen

listen() for use with async / await.

Example

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);
	// 'http://127.0.0.1:3000'
}

main().catch(console.error);