Skip to content

Commit 3af3de2

Browse files
authored
Merge pull request #23 from jsonjoy-com/up
Add support for /up healthcheck
2 parents 73526e4 + 74acf0e commit 3af3de2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/server/http1/Http1Server.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,16 @@ export class Http1Server implements Printable {
333333
});
334334
}
335335

336+
// The /up endpoint is used by Kamal.
337+
public enableKamalPing(path = '/up', response: string | Uint8Array = 'yes') {
338+
this.route({
339+
path,
340+
handler: (ctx) => {
341+
ctx.res.end(response);
342+
},
343+
});
344+
}
345+
336346
// ---------------------------------------------------------------- Printable
337347

338348
public toString(tab = ''): string {

src/server/http1/RpcServer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ export class RpcServer implements Printable {
7272
}
7373

7474
public enableHttpPing(): void {
75-
this.http1.enableHttpPing();
75+
const http1 = this.http1;
76+
http1.enableHttpPing();
77+
http1.enableKamalPing();
7678
}
7779

7880
public enableCors(): void {

0 commit comments

Comments
 (0)