Code Generation
Installation
Make sure you have the Awesome Nest Schematics installed in your project.
If you don't have it installed, you can install it by running the following command:
yarn add -D awesome-nest-schematics
Usage
To generate code using the schematics, run the following command:
$ nest g -c awesome-nestjs-schematics <schematic>
OR
$ yarn generate <schematic> <name>
For example, to generate a new controller:
$ yarn generate controller
Generators and Their Commands
Resource Generator
Generate a new Nest resource, including a controller, service, and module.
$ yarn generate resource
DTO: Generate a new Data Transfer Object.
$ yarn generate dto
Controller: Generate a new Nest controller.
$ yarn generate controller
Decorator: Generate a new Nest decorator.
$ yarn generate decorator
Filter: Generate a new Nest filter.
$ yarn generate filter
Guard: Generate a new Nest guard.
$ yarn generate guard
Interceptor: Generate a new Nest interceptor.
$ yarn generate interceptor
Interface: Generate a new Nest interface.
$ yarn generate interface
Middleware: Generate a new Nest middleware.
$ yarn generate middleware
Module: Generate a new Nest module.
$ yarn generate module
Pipe: Generate a new Nest pipe.
$ yarn generate pipe
Provider: Generate a new Nest provider.
$ yarn generate provider
Service: Generate a new Nest service.
$ yarn generate service
Stay in touch
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.