Added dynamic routes for the API controllers.

This commit is contained in:
Alex Tselegidis 2016-07-08 21:13:40 +02:00
parent 550cee6765
commit a33594a17e
2 changed files with 8 additions and 12 deletions

View file

@ -341,6 +341,7 @@ $config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'csrfToken';
$config['csrf_cookie_name'] = 'csrfCookie';
$config['csrf_expire'] = 7200;
$config['csrf_exclude_uris'] = ['api/v1/.*'];
/*
|--------------------------------------------------------------------------

View file

@ -55,26 +55,21 @@ $route['404_override'] = 'errors/error404';
$resources = [
'appointments',
'customers',
'services'
'services',
'categories',
'admins',
'providers',
'secretaries'
'secretaries',
'settings'
];
foreach($resouces as $resource) {
foreach($resources as $resource) {
$route['api/v1/' . $resource]['post'] = 'api/v1/' . $resource . '/post';
$route['api/v1/' . $resource . '/(:num)']['put'] = 'api/v1/' . $resource . '/put/$1';
$route['api/v1/' . $resource . '/(:num)']['delete'] = 'api/v1/' . $resource . '/delete/$1';
$route['api/v1/' + $resource]['get'] = 'api/v1/' . $resource . '/get';
$route['api/v1/' . $resource]['get'] = 'api/v1/' . $resource . '/get';
$route['api/v1/' . $resource . '/(:num)']['get'] = 'api/v1/' . $resource . '/get/$1';
}
$route['api/v1/appointments']['get'] = 'api/v1/appointments/get';
$route['api/v1/appointments/(:num)']['get'] = 'api/v1/appointments/get/$1';
// $route['api/v1/(:any)']['post'] = 'api/v1/$1/post/';
// $route['api/v1/(:any)/$2']['put'] = 'api/v1/$1/put/$2';
// $route['api/v1/(:any)/$2']['delete'] = 'api/v1/$1/delete/$2';
// $route['api/v1/(:any)/$2']['get'] = 'api/v1/$1/get/$2';
/* End of file routes.php */
/* Location: ./application/config/routes.php */