DocfyModule.forRoot()
Registriert das Modul und lädt jede Companion-Datei für Controller, die mit @WithDocs() markiert sind.
Das Modul importieren
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
Übergib { strict: true }, um beim Start schnell zu scheitern, wenn ein Controller @WithDocs() hat, aber keine Companion-Datei gefunden wird (empfohlen für CI):
ts
DocfyModule.forRoot({ strict: true });main.ts unangetastet
Keine Änderungen an main.ts
Es sind keine Änderungen an main.ts nötig. DocfyModule wendet alle Metadaten an, bevor SwaggerModule.createDocument() aufgerufen wird.