Skip to content

Commit 6d8ccfc

Browse files
committed
add health check api
1 parent cdef2a5 commit 6d8ccfc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default {
2727
return json({
2828
message: "Cloudflare Workers skeleton",
2929
routes: [
30+
"/health",
3031
"/hello",
3132
"/api",
3233
"/request (POST)",
@@ -41,6 +42,10 @@ export default {
4142
});
4243
}
4344

45+
if (path === "/health") {
46+
return json({ status: "ok", timestamp: new Date().toISOString() });
47+
}
48+
4449
if (path.startsWith("/hello")) return handleHello(request, env);
4550
if (path.startsWith("/api")) return handleApi(request, env);
4651
if (path.startsWith("/mcp")) return handleMcp(request, env);

0 commit comments

Comments
 (0)