Add note about unavailable args to remote hooks.
This commit is contained in:
parent
78d1e3b966
commit
61fc2d7158
|
@ -122,7 +122,8 @@ as follows (assuming `name` as the name of the input parameter to resolve):
|
||||||
|
|
||||||
### Remote hooks
|
### Remote hooks
|
||||||
|
|
||||||
Run a function before or after a remote method is called by a client.
|
A _remote hook_ enables you to execute a function before or after a remote method is called by a client.
|
||||||
|
The `beforeRemote` function runs before the remote method and `afterRemote` runs after.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// *.save === prototype.save
|
// *.save === prototype.save
|
||||||
|
@ -139,6 +140,8 @@ User.afterRemote('*.save', function(ctx, user, next) {
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
***NOTE***: The second argument to the hook(`user` in the above example) is the `ctx.result` which is not always available.
|
||||||
|
|
||||||
Remote hooks also support wildcards. Run a function before any remote method is called.
|
Remote hooks also support wildcards. Run a function before any remote method is called.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue