Skip to content

Commit

Permalink
Merge pull request #23 from jsonjoy-com/up
Browse files Browse the repository at this point in the history
Add support for /up healthcheck
  • Loading branch information
streamich authored Oct 10, 2024
2 parents 73526e4 + 74acf0e commit 3af3de2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/server/http1/Http1Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,16 @@ export class Http1Server implements Printable {
});
}

// The /up endpoint is used by Kamal.
public enableKamalPing(path = '/up', response: string | Uint8Array = 'yes') {
this.route({
path,
handler: (ctx) => {
ctx.res.end(response);
},
});
}

// ---------------------------------------------------------------- Printable

public toString(tab = ''): string {
Expand Down
4 changes: 3 additions & 1 deletion src/server/http1/RpcServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export class RpcServer implements Printable {
}

public enableHttpPing(): void {
this.http1.enableHttpPing();
const http1 = this.http1;
http1.enableHttpPing();
http1.enableKamalPing();
}

public enableCors(): void {
Expand Down

0 comments on commit 3af3de2

Please sign in to comment.