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