REST api middleware for using with mongoose and restify/express