Plumier provided extension point to be able to extends the route generation system. This functionalities important when you develop a Facility that handles an endpoint internally and you want this endpoint visible on route analysis or Swagger UI.
RouteMetadata type which separated into 2 kinds:
ActionRouteis a kind of route that handled by controller, this route will have Controller and Action metadata information required by the Open API Specification.
VirtualRouteis a kind of route that handled internally by a middleware, this route doesn't have Controller associated thus it need to specify Open API Specification for
For example you develop a Facility that handles and endpoint to generate CSRF key for the client
/auth/generate-csrf. First you create middleware that handles the
/auth/generate-csrf endpoint like below:
Next you register your middleware above and provide the Virtual Route definition for the
/auth/generate-csrf endpoint like below
Plumier provided function to generate route metadata from controller
generateRoutes. To generate routes from controller simply call the function like below:
Then you can generate the controller from the facility like below