add compose erxample

This commit is contained in:
Andras Bacsai
2024-03-11 09:04:59 +01:00
parent fe01cdfddb
commit 574f02ef76
7 changed files with 235 additions and 0 deletions

16
docker-compose/index.ts Normal file
View File

@@ -0,0 +1,16 @@
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}`);