Nog CLI Developer Guide - v0.10.5
    Preparing search index...

    Generates the primary NestJS module that wires generated services.

    Responsibilities:

    • Emits a dynamic NestJS module with forRoot/forRootAsync supporting runtime configuration (baseUrl, headers).
    • Registers HttpModule with axios config derived from provided options.
    • Provides API_CONFIG token and ApiConfiguration service for downstream consumers.
    • Registers all generated services as providers and exports.
    • Emits the module file as api.module.ts with class name ${moduleName}Module.
    Index

    Constructors

    Methods

    Constructors

    • Instantiates the module writer.

      Parameters

      • project: Project

        The ts-morph Project instance for AST manipulation.

      • outputDir: string

        The target directory where the module file will be written.

      • moduleName: string = 'Api'

        The name stem for the module class (e.g., MyCustom becomes MyCustomModule). Defaults to 'Api'.

      • specTitle: string = 'Unknown Spec'

        The OpenAPI specification title for file header metadata.

      • specVersion: string = 'Unknown Version'

        The OpenAPI specification version for file header metadata.

      Returns ModuleWriter

    Methods

    • Generates the NestJS module file and supporting configuration files.

      Creates:

      • ${outputDir}/api.module.ts – Dynamic module with forRoot and forRootAsync
      • ${outputDir}/api.types.ts – Configuration interfaces and token
      • ${outputDir}/api.configuration.ts – ApiConfiguration service
      • ${outputDir}/api.utils.ts – Utility functions (toFormData)

      Parameters

      • ir: IrDefinition

        The Internal Representation containing the list of services to wire.

      Returns Promise<void>

      Promise resolving when all files are written.