Version: 2.7
Using MikroORM with NestJS framework
#
InstallationEasiest way to integrate MikroORM to Nest is via nestjs-mikro-orm
module.
Simply install it next to Nest, MikroORM and underlying driver:
or
Then import the MikroOrmModule
in your top level module (usually called AppModule
) via
forRoot()
, which will register MikroORM
and EntityManager
services. It will also
create the request context for you automatically.
Then use forFeature()
to register entity repositories at feature module level:
Don't forget to import the feature module in your top level module.