aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/doc.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2021-06-04 08:57:07 +0200
committerRigel Kent <sendmemail@rigelk.eu>2021-06-04 09:21:46 +0200
commit1c627fd8d2e60d4d790353886006485343d70084 (patch)
tree384fcd80a018eab2ace2a340d028b23359c07dc7 /server/middlewares/doc.ts
parentb96d21b744f3b0714636bd43e7f39fb33c3adb73 (diff)
downloadPeerTube-1c627fd8d2e60d4d790353886006485343d70084.tar.gz
PeerTube-1c627fd8d2e60d4d790353886006485343d70084.tar.zst
PeerTube-1c627fd8d2e60d4d790353886006485343d70084.zip
refactor docMiddleware to support operationId-only form
Diffstat (limited to 'server/middlewares/doc.ts')
-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}