Open DahisC opened 2 years ago
以路由(Routing)機制接收特定的請求,通常一個 Controller 都會擁有複數的路由
$ nest g controller [name]
$ nest g resource [name]
以 @Controller() 建立路由,並在括號內填入路由前綴(以簡單地群組化路由)
@Controller()
大多數基礎的 Nest 類別都可以當作 Provider,主要是為了讓 Provider 可以在需要時依賴注入(The main idea of a provider is that it can be injected as a dependency),不同的 Provider 之間可以相互繼承以擴展類別實例的功能
$ nest g service [name]
Module 是建構整個應用程式的組合單位,可包含 Providers, Controllers
$ nest g module cats
Controller
簡介
以路由(Routing)機制接收特定的請求,通常一個 Controller 都會擁有複數的路由
快速建立
單一 Controller
$ nest g controller [name]
CRUD 路由
$ nest g resource [name]
實作
@Controller(路由前綴)
以
@Controller()
建立路由,並在括號內填入路由前綴(以簡單地群組化路由)Provider
簡介
大多數基礎的 Nest 類別都可以當作 Provider,主要是為了讓 Provider 可以在需要時依賴注入(The main idea of a provider is that it can be injected as a dependency),不同的 Provider 之間可以相互繼承以擴展類別實例的功能
快速建立
Service
$ nest g service [name]
Module
簡介
Module 是建構整個應用程式的組合單位,可包含 Providers, Controllers
快速建立
$ nest g module cats