mirror of
https://github.com/coollabsio/coolify-examples.git
synced 2026-02-18 13:28:57 +00:00
16 lines
660 B
TypeScript
16 lines
660 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 === "/blog") return new Response("Blog!");
|
|
if (url.pathname === "/about") return new Response("About!");
|
|
if (url.pathname === "/x") return new Response("a");
|
|
if (url.pathname === "/201") return new Response("201", { status: 201 });
|
|
if (url.pathname === "/202") return new Response("202", { status: 202 });
|
|
return new Response("404!");
|
|
},
|
|
})
|
|
console.log(`Server running at http://localhost:${PORT}`);
|