I want create mvc structure using routing i do something like this$router->add('/',['controller'=> 'home', 'action'=>'index']);
$router->add('{controller}/{action}'); // general case
$router->add('admin/{controller}/{action}',['namespace' => 'admin');
So urls:
Site/ Site/home/index
Site/admin/users/all
Site/controller/action
This works with web pages but the problem how to add routes for API RESTfull ? I try something like this
$router->add('api/{controller}',['namespace'=>'api']);
Without seting action because its bad practice to add the verb in url like this site/api/users/getAll Its must be like this Site/api/users----
So how i can do this with my router ? Any help ?