Files
coolify-examples/docker-compose/index.ts
2024-03-11 09:04:59 +01:00

16 lines
501 B
TypeScript

const PORT = process.env.PORT || 3000;
Bun.serve({
port: PORT,
fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/") return new Response("Home page!");
if (url.pathname === "/envs") {
return new Response(JSON.stringify(process.env, null, 2), {
headers: { "content-type": "application/json" },
});
};
return new Response("404!");
},
})
console.log(`Server running at http://localhost:${PORT}`);