aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/doc.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/middlewares/doc.ts b/server/middlewares/doc.ts
index aa852cd77..3db85c68d 100644
--- a/server/middlewares/doc.ts
+++ b/server/middlewares/doc.ts
@@ -1,13 +1,16 @@
1import * as express from 'express' 1import * as express from 'express'
2 2
3function docMiddleware (docUrl: string) { 3function openapiOperationDoc (options: {
4 url?: string
5 operationId?: string
6}) {
4 return (req: express.Request, res: express.Response, next: express.NextFunction) => { 7 return (req: express.Request, res: express.Response, next: express.NextFunction) => {
5 res.locals.docUrl = docUrl 8 res.locals.docUrl = options.url || 'https://docs.joinpeertube.org/api-rest-reference.html#operation/' + options.operationId
6 9
7 if (next) return next() 10 if (next) return next()
8 } 11 }
9} 12}
10 13
11export { 14export {
12 docMiddleware 15 openapiOperationDoc
13} 16}