Documentation / @zerotal/core / index / ResourceRouteBuilder
Class: ResourceRouteBuilder
Defined in: router/Router.ts:1181
Builds and manages the set of RESTful routes for a resource, with .only()/.except() filtering.
Constructors
Constructor
new ResourceRouteBuilder(
_base,_controller,_middleware):ResourceRouteBuilder
Defined in: router/Router.ts:1193
Parameters
_base
string
_controller
ControllerClass
_middleware
Returns
ResourceRouteBuilder
Methods
only()
only(
actions):this
Defined in: router/Router.ts:1207
Limit this resource to only the specified actions.
Parameters
actions
ResourceAction[]
Returns
this
Example
Router.resource('photos', PhotoController).only(['index', 'show']);
except()
except(
actions):this
Defined in: router/Router.ts:1219
Exclude the specified actions from this resource.
Parameters
actions
ResourceAction[]
Returns
this
Example
Router.resource('tags', TagController).except(['create', 'edit']);