My folder structure for the API files goes as follows:
- api
- common
- controllers
- models
- v1
- controllers
- models
- Module.php
- common
In my config file I have the module registered as:
'modules' => [
'api/v1' => [
'class' => 'app\api\v1\Module',
],
]
I have my url rules registered as:
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
['class' => 'yii\rest\UrlRule', 'controller' => ['api/v1/user', 'api/v1/application', 'api/v1/flag', 'api/v1/role']],
],
]
However, when I make a GET request to /api/v1/users it gives a 404, when presumably according to the docs it should return JSON as if an /index controller action was accessed. Do controllers need to implement the code to get the data and return it, or is it done automatically?