在Debian上查看Swagger文档,可以按照以下步骤进行:
安装Swagger: 首先,确保你已经安装了Swagger。如果使用NestJS框架,可以通过npm或yarn安装相关依赖:
yarn add @nestjs/swagger
配置Swagger: 在你的应用程序入口文件(如main.ts)中进行配置:
import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const config = new DocumentBuilder().build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api', app, document); // 设置swagger的地址url: /api
await app.listen(3000);
}
bootstrap();
访问Swagger文档: 启动应用程序后,打开浏览器并访问以下URL:
http://localhost:3000/api
你将看到默认的接口列表,可以查看和测试你的API文档。
通过以上步骤,你就可以在Debian系统上查看和管理Swagger文档了。