Documentation / @zerotal/core / index / startZerotal
Function: startZerotal()
startZerotal(
loadApp,options?):Promise<void>
Defined in: command/startZerotal.ts:34
Boot and run the Zerotal CLI for an app.
loadApp must dynamically import the app's bootstrap module
(e.g. () => import("./bootstrap/app")). Passing a thunk rather than the app
itself is deliberate and load-bearing:
- it guarantees
APP_ENVis set (from the command) before the app module evaluates, since ES imports are hoisted; and - the literal
import("./bootstrap/app")stays statically analysable, sobun build --compilebundles the app into the production binary.
Parameters
loadApp
() => Promise<{ default: Application; }>
options?
StartZerotalOptions = {}
Returns
Promise<void>
Example
// zt.ts
import { startZerotal } from "@zerotal/core";
await startZerotal(() => import("./bootstrap/app"));