I want to use DIRECTORY STRUCTURE for module. see below
config/ -> general config
models/
modules
api/
components/
config/main.php -> Only config for api
controllers/
Module.php
backend/
components/
config/main.php -> Only config for backend
controllers/
views/
Module.php
frontend/
components/
config/main.php -> Only config for frontend
controllers/
views/
Module.php
web/
index.php
themes/
backend/ -> theme for backend
frontend/ -> theme for frontend
I use this guide http://www.yiiframework.com/doc-2.0/guide-structure-modules.html , http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html
And created main.php config for api
<?php
return [
'components' => [
// list of component configurations
'request' => [
'class' => 'yii\web\Request',
'parsers' => [
'application/json' => 'yii\web\JsonParser',
]
],
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
['class' => 'yii\rest\UrlRule', 'controller' => 'user'],
],
]
],
'params' => [
// list of parameters
],
];
And include it in init() function (Module.php file)
\Yii::configure($this, require(__DIR__ . '/main.php'));
And access to: base_url/api/users, but response is "Page not found."
Please help me