bunbox
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Bun Box

Installation

  1. Install bun & create a new project
❯ mkdir bunbox-example && cd bunbox-example
❯ bun init
# work through prompts
❯ bun install
  1. Install bunbox
❯ bun add bunbox
  1. Create a controller: /controllers/hello.ts
import { Controller } from "bunbox"
import type { Context } from "bunbox"

class HelloController implements Controller {
    route: string
    method: string

    constructor() {
        this.method = "GET"
        this.route = "/hello"
    }

    run = (c: Context) => c.text("Hello!")
}

export default HelloController
  1. Update your index.ts:
import BunBox from "bunbox"
const box = new BunBox()

box.serve()
  1. Run with bun run index.ts:
❯ curl localhost:3000/hello
Hello!

/bunbox/

    Package Sidebar

    Install

    npm i bunbox

    Weekly Downloads

    1

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    12.6 kB

    Total Files

    13

    Last publish

    Collaborators

    • vyder