]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/doc.ts
Merge remote-tracking branch 'weblate/develop' into develop
[github/Chocobozzz/PeerTube.git] / server / middlewares / doc.ts
index aa852cd77fa8bdff19005b47c4f4800c0398dc0e..c43f41977c52e6c312294eb9f155f194198028fd 100644 (file)
@@ -1,13 +1,16 @@
-import * as express from 'express'
+import express from 'express'
 
-function docMiddleware (docUrl: string) {
+function openapiOperationDoc (options: {
+  url?: string
+  operationId?: string
+}) {
   return (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    res.locals.docUrl = docUrl
+    res.locals.docUrl = options.url || 'https://docs.joinpeertube.org/api/rest-reference.html#operation/' + options.operationId
 
     if (next) return next()
   }
 }
 
 export {
-  docMiddleware
+  openapiOperationDoc
 }