WorksheetsTypescript: Nestjs
Total questions: 15
Worksheet time: 8mins
What is NestJS?
A front-end JavaScript framework
A back-end JavaScript framework
A mobile app development framework
A database management framework
NestJS is built on top of which JavaScript runtime?
Node.js
React
Angular
Vue
Which programming language is primarily used in NestJS?
Java
Python
Typescript
C++
NestJS uses which design pattern for organizing code and modules?
MVC (Model-View-Controller)
MVVM (Model-View-ViewModel)
Dependency Injection
Observer
What is the purpose of the @Module decorator in NestJS?
To define a module
To define a component
To define a service
To define a controller
In NestJS, what is a provider?
A database
A service, or repository
A middleware
An Angular component
Which of the following is NOT a valid HTTP method decorator in NestJS?
@Fetch
@Get
@Create
@Update
What is the purpose of the @Controller decorator in NestJS?
To define a module
To define a service
To define a controller
To define a component
In NestJS, how can you inject a service into a controller?
Using @Injectable decorator
Using @Service decorato
Automatically without any decorator
None of the options
What is the purpose of the main.ts file in a NestJS application?
Entry point of the application
Configuration file for the database
File containing middleware definitions
File defining routes
How can you access route parameters in a NestJS controller method?
Using the @Param() decorator
Automatically without any decorator
Using the @Query() decorator
Using the @RouteParams() decorator
How can you handle asynchronous operations in a NestJS controller method?
Using async/await keywords
By defining a separate service for asynchronous tasks
By using the @Async decorator
NestJS does not support asynchronous operations in controllers
Which decorator is used to bind a parameter to the body of a POST request in NestJS?
@Body
@Param
@Request
@Payload
How can you secure routes in NestJS based on user roles?
Using the @SecureRoles() decorator
By implementing role-based guards
Configuring roles in the main.ts file
NestJS does not support role-based access control
How can you define a global exception filter in NestJS?
Using the @Global() decorator on the exception filter class
Using the @UseFilters() decorator on each controller
By configuring it in the main.ts file
NestJS does not support global exception filters
