server-ready

    0.3.1 • Public • Published

    server-ready Build Status npm version

    Know when a server is ready to receive requests. Used in hotel.

    Install

    npm install server-ready --save
    

    Example

    var serverReady = require('server-ready')
    var port = 3000
     
    // A server process is spawned here or somewhere else...
    serverReady(port, function (err) {
      if (err) return console.error('timeout, can\'t connect to port')
      console.log('port is open or has just opened')
    })

    How it works?

    server-ready will try to connect every 250ms to the specified port until a connection has been made or timeout has been reached (20s by default).

    API

    serverReady.timeout

    Default timeout.

    serverReady(port[, host][, timeout], cb)

    Tries to connect to port.

    License

    MIT - Typicode

    Install

    npm i server-ready

    DownloadsWeekly Downloads

    1,504

    Version

    0.3.1

    License

    MIT

    Last publish

    Collaborators

    • typicode