The nitro app to add hooks to.
The config to use for the new instance.
The name to set for this instance.
Optional
forkOptionsFactory: ((event, name) => undefined | ForkOptions)A function to create the fork options for a request. If left undefined, or returns undefined, the default fork options defined in the runtime config are used. This function is called the first time per request, when useEntityManager is used.
The initialized MikroORM instance (same as if you had called useOrm with the same name).
Initializes MikroORM, and register hooks to fork and close it.
Calls initOrm and registers hooks to automatically enable the entity manager for every request with its own context. Limited configuration of the request hook is available as part of ModuleOptions.
If you need more fine-grained permissions for ORM instances, consider setting "routeOptions" to "false", and do whatever checks you need, either in a "request" hook from a Nitro plugin, or in a defineRequestEvent() handler function.
This function also registers a hook to automatically close the ORM on nitro close and unregisters the hooks it registered after the ORM closes successfully. Whether the closing of the ORM is forced or not can be controlled with the runtime config.