 MongoClient.connect process.env.MONGO_URI, (err, db) ->
   return err if err
   app.set 'db', db
+  app.set 'cache', redisClient
 
   if not module.parent
     app.listen app.get 'port'


express = require 'express'
raven   = require 'raven'
MongoClient = require('mongodb').MongoClient

collection = require './collection'
document = require './document'

  req.key = key
  req.usr = apiKeys[key]
  req.db = app.get 'db'
  req.cache = app.get 'cache'

  res.setHeader 'Access-Control-Allow-Origin', '*'

