rembrembdocs

Overview

Build a minimal HTTP server with Bun.serve, run it locally, then evolve it by installing a package.


1

2

3

4

5

🎉 Congratulations! You’ve built an HTTP server with Bun and installed a package.


Run a script

Bun can also execute "scripts" from your package.json. Add the following script:

package.json

{
  "name": "quickstart",
  "module": "index.ts",
  "type": "module",
  "private": true,
  "scripts": { 
    "start": "bun run index.ts"
  }, 
  "devDependencies": {
    "@types/bun": "latest"
  },
  "peerDependencies": {
    "typescript": "^5"
  }
}

Then run it with bun run start.

terminal

bun run start
Listening on http://localhost:3000