Bun 1.0: production-ready JS runtime that's actually fast
Posted by Krishna Vrajendra · 2023-09-10
Bun hits 1.0. Production ready, 95% npm compatible, genuinely faster than Node. Built-in SQLite, test runner, and bundler make it a complete toolchain. https://github.com/oven-sh/bun/releases/tag/bun-v1.0.0
// Bun 1.0 — complete HTTP server
const server = Bun.serve({
port: 3000,
async fetch(req) {
const url = new URL(req.url);
if (url.pathname === '/api/users') {
const db = new Database('app.sqlite');
const users = db.query('SELECT * FROM users').all();
return Response.json(users);
}
return new Response('Not Found', { status: 404 });
},
});
console.log(`Listening on ${server.url}`);