Nest-Cli

2022/10/15 Nest

本文介绍Nest-Cli,以及如何安装cli,以及cli的命令和用法。

# Nest-cli 基本用法 (opens new window)

# 安装

  •   npm install -g @nestjs/cli
    
    1

# 帮助

  •   nest --help
    
    1
  • name alias description
    application application Generate a new application workspace
    class cl Generate a new class
    configuration config Generate a CLI configuration file
    controller co Generate a controller declaration
    decorator d Generate a custom decorator
    filter f Generate a filter declaration
    gateway ga Generate a gateway declaration
    guard gu Generate a guard declaration
    interceptor itc Generate an interceptor declaration
    interface itf Generate an interface
    middleware mi Generate a middleware declaration
    module mo Generate a module declaration
    pipe pi Generate a pipe declaration
    provider pr Generate a provider declaration
    resolver r Generate a GraphQL resolver declaration
    service s Generate a service declaration
    library lib Generate a new library within a monorepo
    sub-app app Generate a new application within a monorepo
    resource res Generate a new CRUD resource

# 获取单个命令的帮助

  •   nest <command> --help
    
    1

# CLI 命令语法

  •   nest commandOrAlias requiredArg [optionalArg] [options]
    
    1
  • 例如
      nest new my-nest-project --dry-run
    
    1

# 简单操作

  • 生成一个User模块
      nest g md User
    
    1
  • 生成RESTful风格
      nest g res Demo
    
    1
最后更新时间: 2022/11/29 11:19:52