Skip to content

Documentation / @andrew_l/app / startApp

Function: startApp() ​

startApp<P, S>(app, props): Promise<ExecResult<{ app: AppInstance<P, S>; }>>

Run setup and entry in one call. Shuts down automatically if entry fails.

Type Parameters ​

P ​

P extends ObjectPropsOptions<Data>

S ​

S extends Record<string, any>

Parameters ​

app ​

AppDefinition<P, S, { }, RuntimeContext<S & object>, EntryContext<S & object>, { log: Logger; }> | AppInstance<P, S, { }>

props ​

ExtractPropTypes<P>

Returns ​

Promise<ExecResult<{ app: AppInstance<P, S>; }>>

Example ​

ts
const result = await startApp(myApp, { port: 3000 });
if (isSuccess(result)) {
  await appWaitShutdown(result.app);
}