Skip to main content
zerotal

Documentation


Documentation / zerotal / index / withApp

Function: withApp()

withApp<T>(app, fn): T

Defined in: packages/core/src/application/currentApp.ts:71

Run fn with app as the current application for the duration of the call — and everything it awaits — overriding the process default within this scope. The override is confined to the async context, so concurrent scopes never leak into one another.

Type Parameters

T

T

Parameters

app

Application

fn

() => T

Returns

T

Example

// Run a migration against a second app's config without disturbing the default.
await withApp(secondApp, () => secondApp.container.make("db"));