mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2026-09-03 20:53:09 -05:00
Add req and res as controllers hooks parameters
Hooks prefixed by `action:api` now give access the original express req and res. Checkout guide.md for possible usage.
This commit is contained in:
@@ -108,6 +108,20 @@ async function register ({
|
||||
}
|
||||
```
|
||||
|
||||
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):
|
||||
|
||||
```js
|
||||
async function register ({
|
||||
registerHook,
|
||||
peertubeHelpers: { logger }
|
||||
}) {
|
||||
registerHook({
|
||||
target: 'action:api.video.updated',
|
||||
handler: ({ req, res }) => logger.debug('original request parameters', { params: req.params })
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
On client side, these hooks are registered by the `clientScripts` files defined in `package.json`.
|
||||
All client scripts have scopes so PeerTube client only loads scripts it needs:
|
||||
|
||||
Reference in New Issue
Block a user