diff --git a/CONTRIBUTORS.svg b/CONTRIBUTORS.svg index ae9179dc..229af931 100644 --- a/CONTRIBUTORS.svg +++ b/CONTRIBUTORS.svg @@ -18,16 +18,16 @@ - - - - - - - - - + + + + + + + + + diff --git a/docs/nestjs.html b/docs/nestjs.html index 3298ddbe..9a595dac 100644 --- a/docs/nestjs.html +++ b/docs/nestjs.html @@ -25,7 +25,7 @@

- + NestJS 备忘清单

NestJS 是一个用于构建高效、可扩展的 Node.js 服务器端应用程序的开发框架

@@ -34,20 +34,12 @@

创建应用

NestCLI

NestJS 需要 Node.js >= 12

-
npm i -g @nestjs/cli
-nest new project-name
+
$ npm i -g @nestjs/cli
+$ nest new project-name
 
-

Nest CLI 是一个命令行界面工具,可以帮助你初始化、开发和维护你的Nest应用程序

-
⚡ We will scaffold your app in a few seconds..
-
-? Which package manager would you ❤️  to use?
- - npm
- - yarn
- - pnpm
-
-

安装依赖并启动开发服务器

-
cd <your-project-name>
-npm run start
+

Nest CLI 是一个命令行界面工具,可以帮助你初始化、开发和维护你的Nest应用程序,安装依赖并启动开发服务器

+
$ cd <your-project-name>
+$ npm run start
 

当你准备将应用发布到生产环境时,请运行:

$ npm run build
@@ -94,16 +86,13 @@
 
 
 
-
-
-
-
-
-
CommandAliasDescription
CommandAliasDescription
newn使用模板快速创建应用
generateg自动生成ControllerProvidersModules
build打包并输出./dist目录
start打包并运行
add安装一个符合Nest的库,同npm install
infoi输出系统信息、CLI版本和Nest Package信息
-

Platform(平台)

-

目前NestJS支持两个Node HTTP平台:ExpressFastify。从技术上讲,一旦创建了适配器,Nest 便可以使用任何 Node HTTP 框架

+
命令别名描述
newn使用模板快速创建应用
generateg自动生成ControllerProvidersModules
build打包并输出./dist目录
start打包并运行
add安装一个符合Nest的库,同npm install
infoi输出系统信息、CLI版本和Nest Package信息
+ +

Platform(平台)

+ +

目前 NestJS 支持两个 Node HTTP 平台:ExpressFastify。从技术上讲,一旦创建了适配器,Nest 便可以使用任何 Node HTTP 框架

platform-express

-
import { NestFactory } from '@nestjs/core'
+
import { NestFactory } from '@nestjs/core'
 import { AppModule } from './app.module'
 import { NestExpressApplication } from '@nestjs/platform-express'
 
@@ -113,8 +102,9 @@
 }
 bootstrap()
 
+

platform-fastify

-
import { NestFactory } from '@nestjs/core'
+
import { NestFactory } from '@nestjs/core'
 import { AppModule } from './app.module'
 import { NestFastifyApplication } from '@nestjs/platform-fastify'
 
@@ -128,26 +118,28 @@
 }
 bootstrap()
 
+

目录

-
├── src             # 源代码目录
-│   ├── app.module.ts            // 应用程序的根模块
-|   └── app.controller.spec.ts   // 控制器的单元测试
-|   ├── app.controller.ts        // 单个路由的基本控制器
-|   └── app.service.ts           // 具有单一方法的基本服务
-|   └── main.ts                  // 应用程序的入口文件,它使用核心函数 NestFactory 来创建 Nest 应用程序的实例
-|
-└── test            # 测试目录
+
├── src      # 源代码目录
+│   ├── app.module.ts          # 应用程序的根模块
+│   ├── app.controller.spec.ts # 控制器的单元测试
+│   ├── app.controller.ts      # 单个路由的基本控制器
+│   ├── app.service.ts         # 具有单一方法的基本服务
+│   └── main.ts # 应用程序的入口文件
+# 它使用核心函数 NestFactory 来创建 Nest 应用程序的实例
+└── test      # 测试目录
     ├── app.e2e-spec.ts
     └── jest-e2e.json
 

JavaScript

NestCLI 默认是使用TypeScript进行初始化项目的,如果需要使用JavaScript请使用以下指令

-
git clone https://github.com/nestjs/javascript-starter.git
+
$ git clone https://github.com/nestjs/javascript-starter.git
 
-cd <javascript-starter>
-npm install
-npm run start
+$ cd <javascript-starter>
+$ npm install
+$ npm run start
 
+

需要注意的一点是,JavaScript的版本是需要Babel

另见

NestJs 官方文档

diff --git a/index.html b/index.html index 2023a912..03e6dfd5 100644 --- a/index.html +++ b/index.html @@ -291,7 +291,7 @@ Yarn - + NestJS

@@ -686,7 +686,7 @@

如果你有资源,可以很方便部署 web 版,这非常简单,只需要克隆 gh-pages 分支代码到你的静态服务就可以了,还可以使用 docker 快捷部署 web 版。

-
+