Moving the api routes to a controller.