aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/doc.ts
blob: 3db85c68d9f27fd07f9d94d7cda13579fb525936 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import * as express from 'express'

function openapiOperationDoc (options: {
  url?: string
  operationId?: string
}) {
  return (req: express.Request, res: express.Response, next: express.NextFunction) => {
    res.locals.docUrl = options.url || 'https://docs.joinpeertube.org/api-rest-reference.html#operation/' + options.operationId

    if (next) return next()
  }
}

export {
  openapiOperationDoc
}