Merge pull request #22 from Frappet/feat/manual
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 8s

feat: add manual endpoint
This commit is contained in:
Methapon Metanipat 2025-03-17 15:18:15 +07:00 committed by GitHub
commit 2f148b6f13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,25 @@
import express from "express";
import { Controller, Get, Path, Request, Route } from "tsoa";
import { getFile } from "../utils/minio";
@Route("api/v1/manual")
export class ManualController extends Controller {
@Get()
async get(@Request() req: express.Request) {
return req.res?.redirect(await getFile(".manual/toc.json"));
}
@Get("{category}/assets/{name}")
async getAsset(@Request() req: express.Request, @Path() category: string, @Path() name: string) {
return req.res?.redirect(await getFile(`.manual/${category}/assets/${name}`));
}
@Get("{category}/page/{page}")
async getContent(
@Request() req: express.Request,
@Path() category: string,
@Path() page: string,
) {
return req.res?.redirect(await getFile(`.manual/${category}/${page}.md`));
}
}