Skip to content
Harry Rabin edited this page Aug 12, 2022 · 8 revisions

constructor(mainBay: MainBay, options?: PBAppOptions)

Constructs a new PBApp instance, and sets the global property PatchBay to itself.

PBAppOptions:

noHandlebars: boolean

Disables the automatic loading of handlebars templates

viewDirectory: string

Overrides the default ./views directory for automatic loading

handlebarsSetup(handlebars: Handlebars): void

A function that takes a handlebars instance reference in order to define partials and helpers before the global templates are compiled. See Partials and Helpers for more details.

handlebarsOptions: Handlebars.CompileOptions

Compile options passed to the Handlebars compiler for each automatically loaded template.

skipGlobal: boolean (advanced)

Prevents the constructor from setting the global property PatchBay. Not recommended for most cases.


serve(options?: PBServeOptions): Server

Tells the PBApp to start serving the main router using Bun's HTTP server. Pass in any options you'd pass to Bun.serve, except for fetch, error, and port.