Add Health Check endpoint

This commit is contained in:
Caleb Braaten 2024-02-20 13:57:55 -08:00
parent a0816fba9e
commit 8e3358d55d

View File

@ -1,8 +1,14 @@
Bun.serve({
port: 8080,
fetch(req, res) {
console.log(`Recieved Request: ${req.method} ${req.url}`);
return Response.redirect(Bun.env.REDIRECT_TARGET, 302);
fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/health") {
console.log("Health Check");
return new Response("ok");
} else {
console.log(`Recieved Request: ${req.method} ${req.url}`);
return Response.redirect(Bun.env.REDIRECT_TARGET, 302);
}
},
});