
Bun Has a Free API Runtime — JavaScript at Native Speed
Bun is an all-in-one JavaScript runtime that is 4x faster than Node.js. It bundles a runtime, package manager, bundler, and test runner in a single tool. What Is Bun? Bun is a drop-in Node.js replacement written in Zig and JavaScriptCore. It starts faster, runs faster, and installs packages faster. Built-in: Runtime (Node.js compatible) Package manager (25x faster than npm) Bundler Test runner SQLite driver HTTP server Quick Start curl -fsSL https://bun.sh/install | bash # Run any JS/TS file bun run index.ts # Install packages (25x faster than npm) bun install express # Run tests bun test HTTP Server API // server.ts — no dependencies needed! Bun . serve ({ port : 3000 , fetch ( req ) { const url = new URL ( req . url ); if ( url . pathname === " /api/hello " ) { return Response . json ({ message : " Hello from Bun! " }); } if ( url . pathname === " /api/users " && req . method === " POST " ) { const body = await req . json (); return Response . json ({ created : true , user : body },
Continue reading on Dev.to JavaScript
Opens in a new tab



