aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'support/doc/plugins')
-rw-r--r--support/doc/plugins/guide.md19
1 files changed, 18 insertions, 1 deletions
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md
index 8e720e94b..bdc9d2ad8 100644
--- a/support/doc/plugins/guide.md
+++ b/support/doc/plugins/guide.md
@@ -12,6 +12,7 @@
12 - [Settings](#settings) 12 - [Settings](#settings)
13 - [Storage](#storage) 13 - [Storage](#storage)
14 - [Update video constants](#update-video-constants) 14 - [Update video constants](#update-video-constants)
15 - [Add custom routes](#add-custom-routes)
15 - [Client helpers (themes & plugins)](#client-helpers-themes--plugins) 16 - [Client helpers (themes & plugins)](#client-helpers-themes--plugins)
16 - [Plugin static route](#plugin-static-route) 17 - [Plugin static route](#plugin-static-route)
17 - [Translate](#translate) 18 - [Translate](#translate)
@@ -71,7 +72,9 @@ async function register ({
71 storageManager, 72 storageManager,
72 videoCategoryManager, 73 videoCategoryManager,
73 videoLicenceManager, 74 videoLicenceManager,
74 videoLanguageManager 75 videoLanguageManager,
76 peertubeHelpers,
77 getRouter
75}) { 78}) {
76 registerHook({ 79 registerHook({
77 target: 'action:application.listening', 80 target: 'action:application.listening',
@@ -178,6 +181,20 @@ videoLicenceManager.addLicence(42, 'Best licence')
178videoLicenceManager.deleteLicence(7) // Public domain 181videoLicenceManager.deleteLicence(7) // Public domain
179``` 182```
180 183
184#### Add custom routes
185
186You can create custom routes using an [express Router](https://expressjs.com/en/4x/api.html#router) for your plugin:
187
188```js
189const router = getRouter()
190router.get('/ping', (req, res) => res.json({ message: 'pong' }))
191```
192
193The `ping` route can be accessed using:
194 * `/plugins/:pluginName/:pluginVersion/router/ping`
195 * Or `/plugins/:pluginName/router/ping`
196
197
181### Client helpers (themes & plugins) 198### Client helpers (themes & plugins)
182 199
183### Plugin static route 200### Plugin static route