Creating an application that has an API component to it?

I am using the yii-basic template and am wondering if there are any tutorials on creating an application that is able to serve regular pages via /controller/action and serve JSON via /api/v1/controller/action. Would this be a case of using some in-depth url rules, or would I need to create a whole new module for the api portion of the application?

Thanks in advance.

Hi Griffolion,

I would say the best way is to rewrite a url rule or extend your UrlManager class to achieve this.

For more info : https://www.yiiframework.com/doc/api/2.0/yii-web-urlmanager

Thanks & Regards,
Johnson