This is a NestJS module to integrate @automapper
with NestJS.
npm i @automapper/nestjs
or with yarn
:
yarn add @automapper/nestjs
@automapper/nestjs
depends on @automapper/core
and @automapper/types
(and some other @nestjs/*
libraries but you should already have these installed in a NestJS application)
npm i @automapper/core
npm i --save-dev @automapper/types
or with yarn
:
yarn add @automapper/core
yarn add --dev @automapper/types
Call AutomapperModule.forRoot()
and provide some options to initialize the Mapper
object(s).
@Module({
imports: [
AutomapperModule.forRoot({
options: [{ name: '', pluginInitializer: classes }],
singular: true,
}),
],
})
export class AppModule {}
AutomapperModule
is a Global
module so when Mapper
object(s) are initialized, they're available across the
application.
Read more about this on the documentation site