   )$ ///
 
   app.get(viewdomain, (req, res) ->
-    elements = req.params[0].split('/')
-    #pages = while ((site = elements.shift()) and (id = elements.shift()))
-    #  if site is 'view' or site is 'my'
-    #    {id}
-    #  else
-    #    {id, site}
     res.sendfile("#{argv.r}/server/sinatra/views/static.html")
   )
 

    next()
  )

  app.get(///^/remote/([a-zA-Z0-9:\.-]+)/([a-z0-9-]+)\.json$///, (req, res)->
    console.log req.params
    getopts = {
      host: req.params[0]
      port: 80
      path: req.params[1]
    }
    console.log getopts
    http.get(getopts, (resp) ->
      res.sendfile(resp.body)
    )
  )

  # Put routes


  app.redirect('index', (req, res) ->
    '/view/welcome-visitors'
  )

  app.redirect('remotefav', (req, res) ->
    console.log req.params
    "http://#{req.params[0]}"
  )

  # Get routes

  app.get('/', (req, res) ->
    res.redirect('index')
  )

  app.get(///^/remote/([a-zA-Z0-9:\.-]+)/([a-z0-9-]+)\.json$///, (req, res) ->
    getopts = {
      host: req.params[0]
      port: 80
      path: "/#{req.params[1]}.json"
    }
    console.log getopts
    http.get(getopts, (resp) ->
      responsedata = ''
      resp.on('data', (chunk) ->
        responsedata += chunk
      )
      resp.on('end', ->
        console.log responsedata
        res.json(JSON.parse(responsedata))
      )
    )
  )

  app.get('*.json', (req, res) ->
