 update_meta = (req, res) ->
 	update_doc req, res, (doc) -> doc.$metadata
 
-# export express app plugin
-module.exports = (app) ->
-	# collections api
-	app.get ':db', ls
-	app.get ':db/:collection', get_collection
-
-	# docs api
-	app.get ':db/:collection/:id', get_doc
-	app.del ':db/:collection/:id', del_doc
-	app.update ':db/:collection/:id', update_doc
-	app.post ':db/:collection', add_doc
-
-	# metadata
-	app.get ':db/:collection/:id/metadata', get_meta
-	app.update ':db/:collection/:id/metadata', update_meta

		newDoc.$metadata.id = newDoc._id
		res.send serialize_doc(newDoc)

# UPDATE :db/:collection/:id
update_doc = (req, res, update_handler) ->
	db = load_db req
	id = req.params.id

			return res.send {error: err} if err
			res.send serialize_doc(doc)

# GET db/collection/id/metadata
get_meta = (req, res) ->
	get_doc req, res, (doc) -> doc.$metadata

