add health check endpoint and update webserver routes

This commit is contained in:
Space-Banane
2026-02-22 14:59:19 +01:00
parent 140d660c1d
commit 5457fb5970
3 changed files with 14 additions and 2 deletions

View File

@@ -10,3 +10,8 @@ services:
ports:
- "$PORT:$PORT"
command: sh -c "npm i -g pnpm && pnpm install && pnpm dev"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:$PORT/health"]
interval: 30s
timeout: 10s
retries: 1

7
src/web/health.ts Normal file
View File

@@ -0,0 +1,7 @@
import { Express } from 'express';
export default function healthRoute(app: Express) {
app.get('/health', (req, res) => {
res.status(200).send('ok');
});
}

View File

@@ -26,7 +26,7 @@ export default async function webserver() {
});
const IgnoredPaths = ['/favicon.ico', '/robots.txt', "/", "/hello"];
const KnownPaths = ["/git-commit", "/"];
const KnownPaths = ["/git-commit", "/", "/health"];
// log all incoming requests
app.use((req, res, next) => {