Node.js / NestJS

NestJS Fundamentals

Modules, Controllers, Providers, Dependency Injection, Decorators, CLI

23 면접 질문·
Junior
1

Which decorator is used to define a controller in NestJS?

답변

The @Controller() decorator marks a class as a controller and optionally accepts a route prefix. Controllers handle incoming HTTP requests and return responses to the client. They use decorators like @Get(), @Post() to define routes.

2

What is a provider in NestJS?

답변

A provider is a class that can be injected as a dependency through NestJS's dependency injection system. Services, repositories, factories, and helpers are providers. They are annotated with @Injectable() and declared in a module's providers array.

3

How to create a new NestJS project with the CLI?

답변

The 'nest new project-name' command creates a new NestJS project with a standard structure including src/, test/, and configuration files. The CLI prompts to choose the package manager (npm, yarn, pnpm) and automatically generates initial code with the root module and a basic controller.

4

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

5

In NestJS, how to inject a service into a controller?

+20 면접 질문

다음 면접을 위해 Node.js / NestJS을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기