[feature/api] Moved code to use controllers

Moved the earlier created API prototype to make use of controllers
and routing instead of having a front-facing file and a separate
class.

PHPBB3-11595