       response.writeHead 404
       response.end('404 Not Found')
 
-  server.listen config.API_PORT
+  server.listen config.API_PORT, config.API_INTERFACE
   console.log "Server listening on port #{config.API_PORT}"

    request.addListener 'end', () ->
      urlParts = url.parse(request.url, true)
      if DEVICES_REGEX.test(urlParts.pathname)
        # TODO search for devices
      else if DEVICE_REGEX.test(urlParts.pathname)
        id = DEVICE_REGEX.exec(urlParts.pathname)[1]
        devicesCollection.findOne({_id : id}, (err, device)->
          if err

  )
else
  server = http.createServer (request, response) ->
    request.content = ''

    request.addListener 'data', (chunk) ->
