| 5 | |
| 6 | @Controller("docs") |
| 7 | export class DocsController { |
| 8 | /** GET /api/docs/<path>.md — returns the raw markdown, or 404. */ |
| 9 | @Public() |
| 10 | @Get("*path") |
| 11 | get(@Param("path") path: string | string[], @Res() res: Response): void { |
| 12 | const slug = Array.isArray(path) ? path : String(path).split("/"); |
| 13 | const md = readDoc(slug); |
| 14 | if (md === null) { |
| 15 | res.status(404).send("not found"); |
| 16 | return; |
| 17 | } |
| 18 | res.setHeader("content-type", "text/markdown; charset=utf-8"); |
| 19 | res.send(md); |
| 20 | } |
| 21 | } |