# server-address

> Listen to a randomly available port and resolve URLs relative to the server address

Latest version **3.0.1** (published 2019-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install server-address
pnpm add server-address
yarn add server-address
bun add server-address
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2019-11-28 |
| First published | 2015-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 21.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Blake Embrey |
| Maintainers | blakeembrey |
| Keywords | server, address, listen, http, https |

## Links

- npm: https://www.npmjs.com/package/server-address
- Repository: https://github.com/blakeembrey/server-address
- Issues: https://github.com/blakeembrey/server-address/issues
- npm.io page: https://npm.io/package/server-address

## Recent versions

- 3.0.1 (latest) — 2019-11-28
- 3.0.0 — 2019-11-06
- 2.0.0 — 2017-10-06
- 1.0.4 — 2016-02-01
- 1.0.3 — 2016-02-01
- 1.0.2 — 2015-08-07
- 1.0.1 — 2015-05-13
- 1.0.0 — 2015-05-13
- 0.0.2 — 2015-01-25
- 0.0.1 — 2015-01-25

## README

# Server Address

[![NPM version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]

> Listen to a randomly available port and resolve URLs relative to the server address.

## Installation

```
npm install server-address --save
```

## Usage

```js
import { ServerAddress } from "server-address";
import * as express from "express";

const app = express();
const server = new ServerAddress(app);

// Listen to randomly available port.
server.listen();

server.url("/foo"); //=> "http://127.0.0.1:58933/foo"

// Close the server connection.
server.close();
```

**Note:** `listen` and `close` can optionally accept callback functions.

## License

MIT license

[npm-image]: https://img.shields.io/npm/v/server-address.svg?style=flat
[npm-url]: https://npmjs.org/package/server-address
[travis-image]: https://img.shields.io/travis/blakeembrey/server-address.svg?style=flat
[travis-url]: https://travis-ci.org/blakeembrey/server-address
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/server-address.svg?style=flat
[coveralls-url]: https://coveralls.io/r/blakeembrey/server-address?branch=master
[downloads-image]: https://img.shields.io/npm/dm/server-address.svg?style=flat
[downloads-url]: https://npmjs.org/package/server-address

---
_Source: https://npm.io/package/server-address · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
