Nest 通过 NestFactory 创建应用并加载根模块。
本节要点
- AppModule 组织功能
- NestFactory.create 创建应用
- listen 启动 HTTP 服务
代码示例
import { NestFactory } from "@nestjs/core"
import { AppModule } from "./app.module"
async function bootstrap() {
const app = await NestFactory.create(AppModule)
await app.listen(3000)
}
bootstrap()