Skip to content

NestJS 基础项目搭建

项目搭建

shell
# node 版本
nvm use 22

# 安装脚手架
pnpm install -g @nestjs/cli

# 创建
nest new project-name
选择 pnpm

# 启动
cd new project-name
npm run start:dev

构建打包

bash
# 启动开发环境
npm run start:dev

# 启动生产环境
npm run start:prod

# 打包构建生产源码
npm run build

# 单元测试
npm run test

# 端对端测试
npm run test:e2e

# eslint 全局校验
npm run lint

# prettier 全局格式化
npm run format