Bun Runtime

Bun

ComeOnOliver Updated 61 repo stars

File contents

Bun

Run & Dev

bun run index.ts
bun --watch index.ts

HTTP Server (fastest in JS ecosystem)

Bun.serve({
    port: 3000,
    fetch(req) {
        const url = new URL(req.url);
        if (url.pathname === "/api") return Response.json({ ok: true });
        return new Response("Hello!");
    },
});

Package Manager: bun install (25x faster than npm)

Bundler: bun build ./index.ts --outdir ./dist

Test Runner: bun test

import { test, expect } from "bun:test";
test("math", () => { expect(2 + 2).toBe(4); });

SQLite built-in: import { Database } from "bun:sqlite";

ComeOnOliver/skillshub/tree/main/skills/skillshub-team/catalog-batch5/bun-runtime commit d32cab086d

Frequently asked questions

npx skillmds@latest add comeonoliver/bun-runtime