Bun Has a Free HTTP Server API: Build Blazing-Fast APIs Without Express
Why Bun's HTTP Server? Bun includes a built-in HTTP server that's 5-10x faster than Node.js + Express. No npm install needed — just Bun.serve() and you have a production-ready server. Quick Start B...

Source: DEV Community
Why Bun's HTTP Server? Bun includes a built-in HTTP server that's 5-10x faster than Node.js + Express. No npm install needed — just Bun.serve() and you have a production-ready server. Quick Start Bun.serve({ port: 3000, fetch(req) { return new Response("Hello World!"); }, }); console.log("Server running on http://localhost:3000"); Run: bun run server.ts Routing Bun.serve({ port: 3000, async fetch(req) { const url = new URL(req.url); if (url.pathname === "/api/users" && req.method === "GET") { const users = await db.query("SELECT * FROM users"); return Response.json(users); } if (url.pathname === "/api/users" && req.method === "POST") { const body = await req.json(); const user = await db.query("INSERT INTO users (name, email) VALUES ($1, $2) RETURNING *", [body.name, body.email]); return Response.json(user, { status: 201 }); } if (url.pathname.startsWith("/api/users/") && req.method === "GET") { const id = url.pathname.split("/")[3]; const user = await db.query(