1.0.1 • Published 5 years ago

get-server-address v1.0.1

Weekly downloads
1,385
License
MIT
Repository
github
Last release
5 years ago

get-server-address

Get the address of a server.

Installation

yarn

Usage

The following code will output: Listening at http://[::]:8888.

import {createServer} from 'http';

const server = createServer();

server.listen(8888, () => {
  const address = getServerAddress(server);
  console.log(`Listening at ${address}`);
});

Will work with express, connect or any other server that imitates Server from the net module.