Skip to content
当前有符合你浏览器所设置语言的版本,是否前往zh-CN版本的网站?
There is a version suitable for your browser's language settings. Would you like to go to the zh-CN language of the site?
HomeDocument

Bootstrap

H1

Bootstrapping is used to perform certain tasks during startup.

In your /milkio.ts file, you can pass the bootstraps option to createMilkioApp. It is an array that can contain any number of regular functions, which can be synchronous or asynchronous.

export const milkio = await createMilkioApp({
bootstraps: () => [helloWorld()],
});
async function helloWorld() {
console.log("Hello World!");
}

During startup, all the functions in the bootstraps array will run simultaneously (yes, this means they are executed in parallel) and the startup phase will only end when all the functions have completed execution. If you want the functions in bootstraps to execute in a specific order, you can use the Middleware feature to achieve that.