+# express = require "express"
+# app = module.exports = express()
+
 util = require "util"
 _ = require "underscore"
 path = require "path"

  # purposefully make this privatish for now
  @file_name = "nedb-filestore.db"
  @file_path = path.join __dirname, "..", "db"
  
  @memory_store = false
  
  if @memory_store == false
    @ds = new DataStore filename: path.join @file_path, @file_name

  if opts? then _.extend @, opts

  # define our route uri w/ version, etc
  uri = util.format if @version? then @prefix + @version else @prefix

  self = @

  # router, output either our errors or a successful response.
  router = (req, res) ->
    crudify self.ds, req, self.cache, (err, resp) ->
      if err? 
        res.status 400 # throw a bad request out there..
        res.send err # send that error baby :/
