I have built an API in laravel. One of the routes it responds to is:
/api/categories/[category_id]
I am working on integrating this with an Angular frontend with a factory so I am doing this:
apiServices.factory('apiService', ['$resource',
function($resource){
return $resource('api/categories', {}, {
'get': {method:'GET', params:{category_id:'@category_id'}, isArray:false}
});
}]);
The get method however returns an URL with a query string like this:
/api/categories?category_id=[category_id]
How can I modify it so that it follows Laravel's API and creates and URL like this:
/api/categories/[category_id]
I would prefer to avoid modifying the API to respond to query strings if possible although I could eventually go that route if changing the factory method is too hard.