Node.js / NestJS

API Documentation & Contracts

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

20 câu hỏi phỏng vấn·
Junior
1

What is Swagger in the context of NestJS?

Câu trả lời

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?

Câu trả lời

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?

Câu trả lời

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 câu hỏi phỏng vấn

Nắm vững Node.js / NestJS cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí