Answer the question
In order to leave comments, you need to log in
How to split a mixed backend?
There is Yiinitializr, in the front there is an old admin panel based on Yii standard components, and partially rewritten in AngularJS. What is the best way to share?
The problem arose due to the fact that there are rules
// REST patterns
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
array('<controller>/index', 'pattern' => 'api/<controller:\w+>', 'verb' => 'POST'),
array('<controller>/index', 'pattern' => 'api/<controller:\w+>', 'verb' => 'POST'),
array('<controller>/index', 'pattern' => 'api/<controller:\w+>', 'verb' => 'GET'),
array('<controller>/view', 'pattern' => 'api/<controller:\w+>/<id:\d+>', 'verb' => 'GET'),
array('<controller>/update', 'pattern' => 'api/<controller:\w+>/<id:\d+>', 'verb' => 'PUT'),
array('<controller>/delete', 'pattern' => 'api/<controller:\w+>/<id:\d+>', 'verb' => 'DELETE'),
array('<controller>/create', 'pattern' => 'api/<controller:\w+>', 'verb' => 'POST'),
array('<controller>/<subaction>', 'pattern' => 'api/<controller:\w+>/<id:\d+>/<subaction:\w+>',
'verb' => 'GET'),
array('<controller>/<subaction>', 'pattern' => 'api/<controller:\w+>/<id:\d+>/<subaction:\w+>',
'verb' => 'POST'),
// default rules
'' => 'site/dashboard',
Answer the question
In order to leave comments, you need to log in
I personally would separate the api and the admin panel into separate modules simply.
As options, you can do this:
If the first three rules are used only for the admin panel, then I would simply add a suitable prefix to them:
...
'admin/<controller:\w+>/<id:\d+>' => 'adminController/view',
'admin/<controller:\w+>/<action:\w+>/<id:\d+>' => 'adminController/<action>',
'admin/<controller:\w+>/<action:\w+>' => 'adminController/<action>'
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question