aboutsummaryrefslogtreecommitdiff
path: root/src/server.ts
diff options
context:
space:
mode:
authorRitesh Ghosh <[email protected]>2024-12-22 00:39:13 +0530
committerRitesh Ghosh <[email protected]>2024-12-22 00:39:13 +0530
commit062e662fbcde1947694b39740b9896f75325959c (patch)
tree892670efbb343804af7fe4a2ef5b68b84f20732c /src/server.ts
parent75dcf6bfeb6bda3c4889f5994c0eaf5b9051cf5c (diff)
downloadaniwatch-api-062e662fbcde1947694b39740b9896f75325959c.tar.xz
aniwatch-api-062e662fbcde1947694b39740b9896f75325959c.zip
feat: add `/v` endpoint for identifying api repo vesion
Diffstat (limited to 'src/server.ts')
-rw-r--r--src/server.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/server.ts b/src/server.ts
index 1b69c39..41a64c5 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -13,6 +13,7 @@ import { serveStatic } from "@hono/node-server/serve-static";
import { HiAnimeError } from "aniwatch";
import { AniwatchAPICache } from "./config/cache.js";
+import pkgJson from "../package.json" with { type: "json" };
import type { AniwatchAPIVariables } from "./config/variables.js";
config();
@@ -36,6 +37,11 @@ if (ISNT_PERSONAL_DEPLOYMENT) {
app.use("/", serveStatic({ root: "public" }));
app.get("/health", (c) => c.text("OK", { status: 200 }));
+app.get("/v", async (c) =>
+ c.text(
+ `v${"version" in pkgJson && pkgJson?.version ? pkgJson.version : "-1"}`
+ )
+);
app.use(async (c, next) => {
const { pathname, search } = new URL(c.req.url);