DomainRedirect/index.js

16 lines
402 B
JavaScript
Raw Normal View History

2024-02-07 14:44:41 +00:00
Bun.serve({
port: 8080,
2024-02-20 21:57:55 +00:00
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);
}
2024-02-07 14:44:41 +00:00
},
});
console.log(`Redirecting Trafic to ${Bun.env.REDIRECT_TARGET}`);