separate web service controller from anothers

hi there

by following this link(http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html) im developing web service for my website, but i cant separate some controllers to be for web service and some of them to be for usual web application

how to do that?

thanks in advanced

You will have to build two types of routes - one for a webapp, the second for an api. Try the below code:




'urlManager' => [

    'enablePrettyUrl' => true,

    'showScriptName' => false,

    'enableStrictParsing' => false,

    'rules' => [

        ['class' => 'yii\rest\UrlRule', 'controller' => 'api'], // for an api

        'webapproute' => ['site/index'], // for webapp

    ],

],