mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
chore(monorepo/server): remove top-level await completely
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
import type { Application } from "express";
|
||||
import swaggerUi from "swagger-ui-express";
|
||||
import { readFile } from "fs/promises";
|
||||
import { fileURLToPath } from "url";
|
||||
import { dirname, join } from "path";
|
||||
import yaml from "js-yaml";
|
||||
import type { JsonObject } from "swagger-ui-express";
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const etapiDocument = yaml.load(await readFile(join(__dirname, "../etapi/etapi.openapi.yaml"), "utf8")) as JsonObject;
|
||||
const apiDocument = JSON.parse(await readFile(join(__dirname, "api", "openapi.json"), "utf-8"));
|
||||
|
||||
function register(app: Application) {
|
||||
export default function register(app: Application) {
|
||||
const etapiDocument = yaml.load(readFileSync(join(__dirname, "../etapi/etapi.openapi.yaml"), "utf8")) as JsonObject;
|
||||
const apiDocument = JSON.parse(readFileSync(join(__dirname, "api", "openapi.json"), "utf-8"));
|
||||
|
||||
app.use(
|
||||
"/etapi/docs/",
|
||||
swaggerUi.serveFiles(etapiDocument),
|
||||
@@ -29,7 +30,3 @@ function register(app: Application) {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export default {
|
||||
register
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user