get-server-address
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i get-server-address

Weekly Downloads

2,347

Version

1.0.1

License

MIT

Unpacked Size

3.56 kB

Total Files

6

Last publish

Collaborators

  • jameslnewell