 
   # piece the url together from the config:
   url = "#{ protocol }//#{ hostname }#{ if port then ":#{port}" else "" }"
+  console.warn "Serving failover url", url
+  return url
 
 failover = (req, res, multi) ->
   if req.params.service in supportedServices

    yes
  else
    no

module.exports = (req, res, next) ->
  { params, query } = req

      else ''
    }"

    request url, (error, response, body) ->
      if not error and response.statusCode is 200 and body

        # we can query for multiple services
        if multi
          try kontrolResponse = JSON.parse body

          if Array.isArray kontrolResponse
            if kontrolResponse.length isnt 0
              return sendBody res, body

        # if query is not multiple then
        # no need for checking array length
        else return sendBody res, body

      return  if failover req, res, multi
      return next()

  else next()  unless failover req, res, multi
