Skip to content

Commit

Permalink
feat: add /v endpoint for identifying api repo vesion
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoshRitesh12 committed Dec 21, 2024
1 parent 75dcf6b commit 062e662
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit 062e662

Please sign in to comment.