|
|
<?php
$params = array_merge( require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php' );
return [ 'id' => 'api', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'api\controllers', 'bootstrap' => ['log'], 'modules' => [], 'components' => [ 'request' => [ 'parsers' => [ 'application/json' => 'yii\web\JsonParser', ], 'csrfParam' => '_csrf-api', ], 'session' => [ // this is the name of the session cookie used for login on the app
'name' => 'api', ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'user' => [ 'identityClass' => 'common\models\User', 'enableAutoLogin' => true, 'identityCookie' => ['name' => '_identity-api', 'httpOnly' => true], ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ ['class' => 'yii\rest\UrlRule', 'controller' => 'goods', 'pluralize' => false], ['class' => 'yii\rest\UrlRule', 'controller' => 'address', 'pluralize' => false], ['class' => 'yii\rest\UrlRule', 'controller' => 'taking-site'], ['class' => 'yii\rest\UrlRule', 'controller' => 'cart'], ['class' => 'yii\rest\UrlRule', 'controller' => 'comment', 'extraPatterns' => [ 'DELETE ' => 'delete' ]], ['class' => 'yii\rest\UrlRule', 'controller' => 'order'], ['class' => 'yii\rest\UrlRule', 'controller' => 'collection', 'extraPatterns' => [ 'DELETE ' => 'delete' ] ], ['class' => 'yii\rest\UrlRule', 'controller' => 'user', 'pluralize' => false, 'extraPatterns' => [ 'GET token' => 'token' ] ], [ 'class' => 'yii\rest\UrlRule', 'controller' => 'admin', 'extraPatterns' => [ 'GET menu' => 'menu', 'GET create' => 'create' ] ], [ 'class' => 'yii\rest\UrlRule', 'controller' => 'site', 'extraPatterns' => [ 'GET index' => 'index', ] ], ], ], ], 'params' => $params, ];
|