Fixed prefix for REST APIs

This commit is contained in:
MatteoF96
2022-11-24 10:16:30 +01:00
parent 582ecc9455
commit 45a0e0e9de
3 changed files with 11 additions and 2 deletions

View File

@ -291,6 +291,7 @@ class Bootstrap implements BootstrapInterface
$config = [
'class' => 'yii\web\GroupUrlRule',
'prefix' => $module->adminRestPrefix,
'routePrefix' => $module->adminRestRoutePrefix,
'rules' => $rules,
];
$rule = Yii::createObject($config);

View File

@ -260,9 +260,13 @@ class Module extends BaseModule
*/
public $authenticatorClass = 'yii\filters\auth\QueryParamAuth';
/**
* @var string Route prefix for REST admin controller.
* @var string Prefix for the pattern part of every rule for REST admin controller.
*/
public $adminRestPrefix = 'user/api/v1';
/**
* @var string Prefix for the route part of every rule for REST admin controller.
*/
public $adminRestRoutePrefix = 'user/api/v1';
/**
* @var array Routes for REST admin controller.
*/