Added a bunch of stuff for getting the MongoDB ready.
Added the API before the middleware so that api requests wouldn't pass through the middlewares.
started getting the authentication thing down.