Custom Route Generator
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.
Action Routes and Virtual Routes#
Plumier provided 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 forOperationitself.
Example#
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
Generate ActionRoute from Controller#
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
