Rewrites rest server to use mongoose