@automatons/typescript-server-nestjs
v1.0.0
Published
[](https://github.com/openapi-automatons/typescript-server-nestjs/actions/workflows/ci-cd.yml) [ and type aliases,services/<tag>.service.ts— an abstract<Tag>Serviceclass declaring the methods you must implement,controllers/<tag>.controller.ts— a@Controller()that wires the routes and delegates to the injected service.
You implement the abstract service and wire it into your own module — regenerating never touches that code.
@nestjs/common, class-validator and class-transformer are peer dependencies.
Generated server
// your code — implement the generated contract
import { Injectable } from "@nestjs/common";
import { PetsService } from "./generated/services";
import { Pet } from "./generated/dto";
@Injectable()
export class PetsServiceImpl extends PetsService {
async showPetById(petId: string): Promise<Pet> {
// ...your logic
}
}
// wire it in your module
@Module({
controllers: [PetsController],
providers: [{ provide: PetsService, useClass: PetsServiceImpl }],
})
export class PetsModule {}How can I use @automatons/typescript-server-nestjs?
This library is designed to be used by openapi-automatons. Please read the readme of openapi-automatons for how to use it.
