Docs / API Reference / Policy
If you're looking for the walkthrough guide on Policies, see: 2.3 Policy
A Policy is a special kind of handler that decides whether to forward requests to the Controllers. Trails Policy classes are singletons; that is, each subclassed Policy is instantiated once, and that reference is maintained during the life of the program.
Initialize the Policy with the provided app
instance.
@param | type | description | required? |
---|---|---|---|
app |
Trails |
the Trails application instance | yes |
None.
Return the id of the Policy. e.g. for UserPolicy
, the id
will be user
.
The application's Logger instance. Convenience reference for this.app.log
.
The i18n translator instance. Convenience reference for this.app.__
.
Convenience reference to this.app.services
.