get-server-address
v1.0.1
Published
Get the address of a server.
Downloads
5,756
Readme
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 imitatesServer
from thenet
module.