]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/doc.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / middlewares / doc.ts
index aa852cd77fa8bdff19005b47c4f4800c0398dc0e..eef76acaa03e4363bcfd125daef7a75d75264995 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
 }