X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fdoc.ts;h=eef76acaa03e4363bcfd125daef7a75d75264995;hb=e722fb5923ddf11d72e48cec9788abc64327c22f;hp=aa852cd77fa8bdff19005b47c4f4800c0398dc0e;hpb=e030bfb59dd5ee65f20a64686ec9b22ca39f70ae;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/doc.ts b/server/middlewares/doc.ts index aa852cd77..eef76acaa 100644 --- a/server/middlewares/doc.ts +++ b/server/middlewares/doc.ts @@ -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 }