RESTful 风格设计
- 接口 URL 风格
- 版本控制
- code 码规范
在 main.ts 文件中配置
import {VersioningType } from '@nestjs/common';
app.enableVersioning({ type: VersioningType.URI });
在 controller 中使用
// 类
@Controller({
path: '',
version: '1',
})
// 方法
@Version('1')
在 main.ts 文件中配置
import {VersioningType } from '@nestjs/common';
app.enableVersioning({ type: VersioningType.URI });
在 controller 中使用
// 类
@Controller({
path: '',
version: '1',
})
// 方法
@Version('1')