Skip to content

FlareAppNode

class FlareAppNode extends FlareAppBase<"async">

Compiled Flare application for Node.js. Serves requests via the built-in node:http server with graceful shutdown on signal or fatal error.

Handed to you by the framework; see Run and shutdown.

host: IFlareHost<"async">
http: HttpArc<"async">
run(options?: NodeRunOptions): NodeRunHandle

Starts the HTTP server, binds process signal handlers, and returns a handle for stopping the application without exiting the host process.

options? NodeRunOptions

returns NodeRunHandle

Throws:

If invoked more than once on the same app instance.

test(_opts?: AppTestOptions): Promise<TestAppHandle>

Starts the application in test mode and returns a TestAppHandle for driving synthetic requests. Mirrors how run() (Node) returns a NodeRunHandle and export() (CF) returns a { fetch } handle.

The base implementation throws when FLARE_MODE=test was not set, so host.build() returned a production app rather than the test variant. Set FLARE_MODE=test before importing the host module (vitest: test.env.FLARE_MODE = 'test'). FlareTestApp overrides with the real implementation.

_opts? AppTestOptions

returns Promise<TestAppHandle>

Learn: Run and shutdown

Last updated: