diff options
Diffstat (limited to 'support/doc/plugins')
-rw-r--r-- | support/doc/plugins/guide.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md index 072c7c6ca..acf4718e4 100644 --- a/support/doc/plugins/guide.md +++ b/support/doc/plugins/guide.md | |||
@@ -108,6 +108,20 @@ async function register ({ | |||
108 | } | 108 | } |
109 | ``` | 109 | ``` |
110 | 110 | ||
111 | Hooks prefixed by `action:api` also give access the original **express** [Request](http://expressjs.com/en/api.html#req) and [Response](http://expressjs.com/en/api.html#res): | ||
112 | |||
113 | ```js | ||
114 | async function register ({ | ||
115 | registerHook, | ||
116 | peertubeHelpers: { logger } | ||
117 | }) { | ||
118 | registerHook({ | ||
119 | target: 'action:api.video.updated', | ||
120 | handler: ({ req, res }) => logger.debug('original request parameters', { params: req.params }) | ||
121 | }) | ||
122 | } | ||
123 | ``` | ||
124 | |||
111 | 125 | ||
112 | On client side, these hooks are registered by the `clientScripts` files defined in `package.json`. | 126 | On client side, these hooks are registered by the `clientScripts` files defined in `package.json`. |
113 | All client scripts have scopes so PeerTube client only loads scripts it needs: | 127 | All client scripts have scopes so PeerTube client only loads scripts it needs: |