Prefix route
See original GitHub issueHi, I’m using API plaform for my development and I have some problem when i use prefix in routing.yml and custom Action.
My routing.yml :
api:
resource: '.'
type: 'api_platform'
prefix: '/api'
app:
resource: '@AppBundle/Action/'
type: 'annotation'
prefix: '/api'
I wrote a custom Action :
class ApiCustomersPost
{
/**
* @Route(
* name="API_Customers_post",
* path="/customers",
* defaults={"_api_resource_class"=Customers::class, "_api_collection_operation_name"="post"}
* )
* @Method("POST")
*/
public function __invoke($data)
{
return $data;
}
}
When a I go to the doc I can see my route prefixed by “/api”
And the base URL in documentation is :
I this case, when I want to test my route, the documentation try to call “/api/api/customers”
But my routing is ok : with php bin/console router:debug
I get :
API_Customers_post POST ANY ANY /api/customers
And It work when I call the route /api/customers
with postman.
How can I handle this ?
Regards,
TF
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:10 (3 by maintainers)
Top Results From Across the Web
RoutePrefix vs Route
Route prefixes are associated with routes by design in attribute routing. It is used to set a common prefix for an entire controller....
Read more >Route Prefix in Web API with Examples
The Attribute Routing Route Prefix in Web API is used to specify the common route prefix at the controller level to eliminate the...
Read more >Prefixes vs Routes vs Network - Routing & Switching
A route is a particular entry in the routing table. A route is composed of a prefix, and either a next hop IP,...
Read more >Routing - Laravel - The PHP Framework For Web Artisans
Routes defined in the routes/api.php file are nested within a route group by the RouteServiceProvider . Within this group, the /api URI prefix...
Read more >ip-prefix-routes | Junos OS
A pure Type 5 route advertises the summary IP prefix and includes a BGP extended community called a router MAC. The router MAC...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This one: https://github.com/api-platform/core/pull/1192
This has been fixed in core by @meyerbaptiste