add health check endpoint and update webserver routes
This commit is contained in:
@@ -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
7
src/web/health.ts
Normal 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');
|
||||
});
|
||||
}
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user