Bun

interface

UnixServeOptions

interface UnixServeOptions

  • development?: boolean | { console: boolean; hmr: boolean }

    Render contextual errors? This enables bun's error page

  • error?: (this: Server, error: ErrorLike) => void | Promise<void> | Response | Promise<Response>
  • id?: null | string

    Uniquely identify a server instance with an ID


    When bun is started with the --hot flag:

    This string will be used to hot reload the server without interrupting pending requests or websockets. If not provided, a value will be generated. To disable hot reloading, set this value to null.

    When bun is not started with the --hot flag:

    This string will currently do nothing. But in the future it could be useful for logs or metrics.

  • maxRequestBodySize?: number

    What is the maximum size of a request body? (in bytes)

  • unix: string

    If set, the HTTP server will listen on a unix socket instead of a port. (Cannot be used with hostname+port)

  • this: Server,
    request: Request,
    server: Server
    ): Response | Promise<Response>;

    Handle HTTP requests

    Respond to Request objects with a Response object.