1.0.1 • Published 7 years ago
get-server-address v1.0.1
get-server-address
Get the address of a server.
Installation
yarnUsage
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,connector any other server that imitatesServerfrom thenetmodule.