Skip to content

Link

NestJs CLI Usages

Describe

NestJs Command Line Interface 입니다.
저는 처음 배울때는 자주 썼으나 지금은 잘 사용하지 않습니다.
처음에는 보통 module, controller, service를 만드는데 많이 사용하게 됩니다.

Usages

sh
nest generate <schematic> <name> [options]
nest g <schematic> <name> [options]

Arguments

ArgumentDescription
<schematic>아래 schematics table에 내용정리
<name>원하는 이름

Schematics

NameAliasDescription
app모노레포에서 사용되는데 이건 나중에..
librarylib이것도 모노레포에서..
classclGenerate a new class.
controllercoGenerate a controller declaration.
decoratordGenerate a custom decorator.
filterfGenerate a filter declaration.
gatewaygaGenerate a gateway declaration.
guardguGenerate a guard declaration.
interfaceitfGenerate an interface.
interceptoritcGenerate an interceptor declaration.
middlewaremiGenerate a middleware declaration.
modulemoGenerate a module declaration.
pipepiGenerate a pipe declaration.
providerprGenerate a provider declaration.
resolverrGenerate a resolver declaration.
resourceresGenerate a new CRUD resource. See the CRUD (resource) generator for more details. (TS only)
servicesGenerate a service declaration.

Options

OptionDescription
--dry-run잘 실행되는지 확인하기 위해 사용 Alias: -d
--project [project]해당 요소를 추가할 프로젝트를 정한다. 모노레포에서 주로 사용. Alias: -p
--flat폴더를 만들지 않는다.
--spectest 할 수 있는 spec 파일을 만들어준다. (default)
--no-specspec 파일 없이 만든다.