index.js
function createServer(webhook)
{
  var self = this

  var onError = this.emit.bind(this, 'error')

  var port     = webhook.port     || 0
  var hostname = webhook.hostname || HOSTNAME

  var server = http.createServer(function(req, res)
  {
    if(req.method === 'GET')
    {
      res.end()

      return self.push(parse(req.url).query)
    }

    req.pipe(concat(function(body)
    {
      res.end()

      self.push(body.toString())
    }))
  })
  .listen(port, hostname, function()
  {
    var address = this.address()

    if(hostname === HOSTNAME) hostname = getHostname()

    if(!hostname)
    {
      self.emit('error', new Error("There's no public available interfaces"))

      return this.close()
    }

    self.emit('open', 'http://'+hostname+':'+address.port)
  })
  .on('error'      , onError)
  .on('clientError', onError)

  return server
}
function createServer(webhook)
{
  var self = this

  var onError = this.emit.bind(this, 'error')

  var port     = webhook.port     || 0
  var hostname = webhook.hostname || HOSTNAME

  var server = http.createServer(function(req, res)
  {
    if(req.method === 'GET')
    {
      res.end()

      return self.push(parse(req.url).query)
    }

    req.pipe(concat(function(body)
    {
      res.end()

      self.push(body.toString())
    }))
  })
  .listen(port, hostname, function()
  {
    var address = this.address()

    if(hostname === HOSTNAME) hostname = getHostname()

    if(!hostname)
    {
      self.emit('error', new Error("There's no public available interfaces"))

      return this.close()
    }

    self.emit('open', 'http://'+hostname+':'+address.port)
  })
  .on('error'      , onError)
  .on('clientError', onError)

  return server
}
function createServer ( webhook ) { var self = this var onError = this . emit . bind ( this , 'error' ) var port = webhook . port || 0 var hostname = webhook . hostname || HOSTNAME var server = http . createServer ( function ( req , res ) { if ( req . method === 'GET' ) { res . end ( ) return self . push ( parse ( req . url ) . query ) } req . pipe ( concat ( function ( body ) { res . end ( ) self . push ( body . toString ( ) ) } ) ) } ) . listen ( port , hostname , function ( ) { var address = this . address ( ) if ( hostname === HOSTNAME ) hostname = getHostname ( ) if ( ! hostname ) { self . emit ( 'error' , new Error ( "There's no public available interfaces" ) ) return this . close ( ) } self . emit ( 'open' , 'http://' + hostname + ':' + address . port ) } ) . on ( 'error' , onError ) . on ( 'clientError' , onError ) return server }
Create an ad-hoc web server where to receive the webhook notifications

@param {Object} webhook
@param {string} [webhook.hostname='0.0.0.0']
@param {Number} [webhook.port=0]

@return {http.Server}
Create an ad - hoc web server where to receive the webhook notifications