mirror of
https://github.com/zadam/trilium.git
synced 2025-10-09 23:18:46 +08:00
feat(docs): implement swagger ui endpoint for internal api (#6719)
This commit is contained in:
commit
8abd3ed3f1
3 changed files with 4672 additions and 3 deletions
4667
apps/server/src/assets/api-openapi.yaml
Normal file
4667
apps/server/src/assets/api-openapi.yaml
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -8,7 +8,9 @@ import { RESOURCE_DIR } from "../services/resource_dir";
|
||||||
|
|
||||||
export default function register(app: Application) {
|
export default function register(app: Application) {
|
||||||
const etapiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "etapi.openapi.yaml"), "utf8")) as JsonObject;
|
const etapiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "etapi.openapi.yaml"), "utf8")) as JsonObject;
|
||||||
const apiDocument = JSON.parse(readFileSync(join(RESOURCE_DIR, "openapi.json"), "utf-8"));
|
|
||||||
|
// Load the comprehensive API documentation from YAML
|
||||||
|
const apiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "api-openapi.yaml"), "utf8")) as JsonObject;
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
"/etapi/docs/",
|
"/etapi/docs/",
|
||||||
|
@ -24,7 +26,8 @@ export default function register(app: Application) {
|
||||||
swaggerUi.serveFiles(apiDocument),
|
swaggerUi.serveFiles(apiDocument),
|
||||||
swaggerUi.setup(apiDocument, {
|
swaggerUi.setup(apiDocument, {
|
||||||
explorer: true,
|
explorer: true,
|
||||||
customSiteTitle: "TriliumNext Internal API Documentation"
|
customSiteTitle: "TriliumNext Internal API Documentation",
|
||||||
|
customCss: '.swagger-ui .topbar { display: none }'
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue