Neptune: Planet or Myth?
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    server-addresspublic

    Server Address

    NPM version NPM Downloads Build status Test coverage Greenkeeper badge

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

    Installation

    npm install server-address --save
    

    Usage

    var serverAddress = require('server-address')
    var express = require('express')
    var app = express()
     
    var server = 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.

    TypeScript

    Includes a TypeScript type definition.

    License

    MIT license

    install

    npm i server-address

    Downloadsweekly downloads

    54

    version

    2.0.0

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar