DocfyModule.forRoot()
Registers the module and loads every companion file for controllers marked with @WithDocs().
Import the module
app.module.ts
// app.module.ts
import { Module } from "@nestjs/common";
import { DocfyModule } from "nestjs-docfy";
@Module({
imports: [DocfyModule.forRoot()],
})
export class AppModule {}strict: true
Pass { strict: true } to fail fast at startup when a controller has @WithDocs() but no companion file is found (recommended for CI):
ts
DocfyModule.forRoot({ strict: true });main.ts untouched
No changes to main.ts
No changes to main.ts are needed. DocfyModule applies all the metadata before SwaggerModule.createDocument() is called.