# Functions

The ./src/index.js file includes global register, bootstrap and destroy functions that can be used to add dynamic and logic-based configurations.

# Register

The register found in ./src/index.js lifecycle function is an asynchronous function that runs before the application is initialized. It can be used to:

# Bootstrap

The bootstrap lifecycle function found in ./src/index.js is called at every server start.

It can be used to:

The bootstrap function can be synchronous, asynchronous, or return a premise:

Synchronous function

module.exports = () => {
  // some sync code
};

Asynchronous function

module.exports = async () => {
  await someSetup();
};

Function returning a promise

module.exports = () => {
  return new Promise(/* some code */);
};

# Destroy

The destroy function found in ./src/index.js is an asynchronous function that runs before the application gets shut down.

It can be used to gracefully: