← 返回命令列表

Linux command

nest 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create new project

nest new [project-name]

Generate controller

nest generate controller [name]

Generate service

nest generate service [name]

Generate module

nest generate module [name]

Generate resource

nest generate resource [name]

Start development server

nest start --watch

Build for production

nest build

Show help

nest --help

说明

nest is the CLI for NestJS, a progressive Node.js framework for building server-side applications. It generates projects and components following NestJS conventions. New projects include TypeScript configuration, testing setup, and the NestJS module structure. The generator creates controllers, services, modules, and other components. The resource generator creates complete CRUD functionality including controller, service, DTOs, and entities. It can generate REST, GraphQL, or WebSocket resources. Development server includes hot reload. Code changes trigger automatic restart. Production builds optimize for deployment. The modular architecture separates concerns into modules, each containing related controllers, services, and providers. The CLI maintains this structure. NestJS supports Express or Fastify as underlying HTTP servers, with decorators providing routing and dependency injection.

参数

new _NAME_
Create new project.
generate, g _TYPE_ _NAME_
Generate component.
start
Start application.
build
Build application.
info
Display project info.
add _LIBRARY_
Add NestJS library.
--watch, -w
Watch mode for development.
--prod
Build for production.
--flat
Don't create directory for generated file.
--spec
Generate spec file (default true).
--no-spec
Skip spec file generation.
--dry-run, -d
Report actions without writing.
--skip-git
Skip git initialization.

FAQ

What is the nest command used for?

nest is the CLI for NestJS, a progressive Node.js framework for building server-side applications. It generates projects and components following NestJS conventions. New projects include TypeScript configuration, testing setup, and the NestJS module structure. The generator creates controllers, services, modules, and other components. The resource generator creates complete CRUD functionality including controller, service, DTOs, and entities. It can generate REST, GraphQL, or WebSocket resources. Development server includes hot reload. Code changes trigger automatic restart. Production builds optimize for deployment. The modular architecture separates concerns into modules, each containing related controllers, services, and providers. The CLI maintains this structure. NestJS supports Express or Fastify as underlying HTTP servers, with decorators providing routing and dependency injection.

How do I run a basic nest example?

Run `nest new [project-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does new _NAME_ do in nest?

Create new project.