Adding API routes and adapting API controller to handle some REST stuff by itself