0
0
NestJSframework~10 mins

Feature modules in NestJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the feature module into the root module.

NestJS
import { Module } from '@nestjs/common';
import { UsersModule } from './users/users.module';

@Module({
  imports: [[1]],
})
export class AppModule {}
Drag options to blanks, or click blank then click option'
AUsersModules
BUserModule
CusersModule
DUsersModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect casing like 'usersModule' or plural forms.
Misspelling the module name.
2fill in blank
medium

Complete the code to declare a controller inside a feature module.

NestJS
import { Module } from '@nestjs/common';
import { UsersController } from './users.controller';

@Module({
  controllers: [[1]],
})
export class UsersModule {}
Drag options to blanks, or click blank then click option'
AUsersController
BusersController
CUserController
DUsersControllers
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular form 'UserController' when the file exports 'UsersController'.
Incorrect casing like 'usersController'.
3fill in blank
hard

Fix the error in the feature module by completing the providers array.

NestJS
import { Module } from '@nestjs/common';
import { UsersService } from './users.service';

@Module({
  providers: [[1]],
})
export class UsersModule {}
Drag options to blanks, or click blank then click option'
AusersService
BUsersService
CUserService
DUsersServices
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular 'UserService' when the service is named 'UsersService'.
Incorrect casing or pluralization.
4fill in blank
hard

Fill both blanks to export the service and import the feature module correctly.

NestJS
import { Module } from '@nestjs/common';
import { UsersService } from './users.service';

@Module({
  providers: [[1]],
  exports: [[2]],
})
export class UsersModule {}
Drag options to blanks, or click blank then click option'
AUsersService
BUserService
CUsersModule
DUsersServices
Attempts:
3 left
💡 Hint
Common Mistakes
Exporting the module instead of the service.
Using incorrect service names or casing.
5fill in blank
hard

Fill all three blanks to create a feature module with controller, service, and export the service.

NestJS
import { Module } from '@nestjs/common';
import { UsersController } from './users.controller';
import { UsersService } from './users.service';

@Module({
  controllers: [[1]],
  providers: [[2]],
  exports: [[3]],
})
export class UsersModule {}
Drag options to blanks, or click blank then click option'
AUsersController
BUsersService
DUserController
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up controller and service names.
Not exporting the service when needed.