 app     = express()
 turbase = require './turbase'
 
+debug = false
+
 # Logging
-app.use express.logger()
+# app.use express.logger()
 # Query params
 app.use express.bodyParser()
 # Error handling


# Error handling
app.use (err, req, res, next) ->
  console.error err.stack
  res.jsonp 500, {'err':err}

app.listen 4000
console.log 'Nasjonal turbase running on port 4000'

    "nrk":
      "navn": "NRK"

  if typeof req.query.api_key is 'undefined' or typeof eiere[req.query.api_key] is 'undefined'
    err = new Error('API Authentication Failed')
    err.mesg = 'AuthenticationFailed'
    err.code = 403
    return next err

  req.eier = eiere[req.query.api_key].navn

  data = req.params?.data or req.query?.data
  if data
    req.data = JSON.parse data if data
    req.data.eier = req.eier

  next()

# Routing
