chore(nx/server): move source code

This commit is contained in:
Elian Doran
2025-04-22 17:16:41 +03:00
parent 9c0d42252e
commit b2af043110
889 changed files with 10 additions and 30 deletions

View File

@@ -0,0 +1,23 @@
import type { Router } from "express";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const specPath = path.join(path.dirname(fileURLToPath(import.meta.url)), "etapi.openapi.yaml");
let spec: string | null = null;
function register(router: Router) {
router.get("/etapi/etapi.openapi.yaml", (req, res, next) => {
if (!spec) {
spec = fs.readFileSync(specPath, "utf8");
}
res.header("Content-Type", "text/plain"); // so that it displays in browser
res.status(200).send(spec);
});
}
export default {
register
};