Node.js / NestJS

API Documentation & Contracts

Swagger, OpenAPI, versioning, documentation per version, Postman, collections, API contracts

20 面接問題·
Junior
1

What is Swagger in the context of NestJS?

回答

Swagger is a tool that automatically generates interactive REST API documentation by analyzing NestJS decorators. This documentation allows you to visualize and test endpoints directly from a web interface accessible via /api. Installing the @nestjs/swagger package and configuring SwaggerModule in main.ts are required to use it.

2

Which package should be installed to use Swagger in NestJS?

回答

The @nestjs/swagger package is the official library for integrating Swagger into a NestJS application. You also need to install swagger-ui-express which provides the interactive web interface. These two packages work together to generate OpenAPI documentation and display it in the browser.

3

Where to configure SwaggerModule in a NestJS application?

回答

SwaggerModule is configured in the main.ts file after creating the NestJS application with NestFactory.create(). The SwaggerModule.setup() method takes three parameters: the documentation path, the application instance, and the document generated by createDocument(). This configuration must be done before app.listen() so the documentation is accessible at startup.

4

What is the role of the @ApiTags() decorator?

5

What is OpenAPI?

+17 面接問題

次の面接に向けてNode.js / NestJSをマスター

すべての問題、flashcards、技術テスト、コードレビュー演習、面接シミュレーターにアクセス。

無料で始める