Answer the question
In order to leave comments, you need to log in
How to set up routes in a Yii2 REST application?
I'm setting up routes in a REST application. it is necessary that the request to /api/basicapp/v01/json/tag/ goes to the tag controller (respectively, to the index action).
How to do it?
Now there is this:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'class' => 'yii\rest\UrlRule',
'controller' => 'tag',
]
] ,
Answer the question
In order to leave comments, you need to log in
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => false,
'showScriptName' => false,
'rules' => [
[ 'class' => 'yii\rest\UrlRule',
'controller' => ['tag' => 'tag'],
'prefix' => 'api/basicapp/<version:\w+>/json'
]
]
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question