Bun 1.1 ships Windows: 25x faster installs everywhere
Posted by Laxman Saumitra · 2024-05-23
Bun 1.1 runs natively on Windows. Package installs are 25x faster than npm across all platforms. Node compat hits 90%. https://github.com/oven-sh/bun/releases/tag/bun-v1.1.0
// Bun 1.1 — built-in SQLite + HTTP server
import { Database } from 'bun:sqlite';
const db = new Database('app.db');
db.run('CREATE TABLE IF NOT EXISTS todos (id INTEGER PRIMARY KEY, text TEXT, done BOOLEAN)');
Bun.serve({
port: 3000,
async fetch(req) {
const url = new URL(req.url);
if (req.method === 'GET' && url.pathname === '/todos') {
return Response.json(db.query('SELECT * FROM todos').all());
}
if (req.method === 'POST' && url.pathname === '/todos') {
const { text } = await req.json();
db.run('INSERT INTO todos (text, done) VALUES (?, 0)', [text]);
return Response.json({ ok: true });
}
return new Response('Not found', { status: 404 });
}
});