add health endpoint for healthchecks (#27)

This commit is contained in:
Fijxu 2024-12-25 08:55:41 -03:00 committed by GitHub
parent f89f41380a
commit d53d10b774
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

12
src/routes/health.ts Normal file
View file

@ -0,0 +1,12 @@
import { Hono } from "hono";
const health = new Hono();
health.get("/", () => {
return new Response("OK", {
status: 200,
headers: { "Content-Type": "text/plain" },
});
});
export default health;

View file

@ -7,6 +7,7 @@ import youtubeApiPlayer from "./youtube_api_routes/player.ts";
import invidiousRouteLatestVersion from "./invidious_routes/latestVersion.ts";
import invidiousRouteDashManifest from "./invidious_routes/dashManifest.ts";
import videoPlaybackProxy from "./videoPlaybackProxy.ts";
import health from "./health.ts";
export const routes = (app: Hono, konfigStore: Store<Record<string, unknown>>) => {
app.use("*", logger());
@ -22,4 +23,5 @@ export const routes = (app: Hono, konfigStore: Store<Record<string, unknown>>) =
app.route("/latest_version", invidiousRouteLatestVersion);
app.route("/api/manifest/dash/id", invidiousRouteDashManifest);
app.route("/videoplayback", videoPlaybackProxy);
app.route("/healthz", health);
};