0
0
NestJSframework~10 mins

Why microservices scale independently in NestJS - Test Your Understanding

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

Complete the code to create a microservice that listens on a TCP transport.

NestJS
const app = await NestFactory.createMicroservice(AppModule, { transport: Transport.[1] });
Drag options to blanks, or click blank then click option'
ATCP
BHTTP
CWS
DREDIS
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTP transport which is not typical for NestJS microservices.
Choosing WebSocket which is for real-time communication, not general microservices.
2fill in blank
medium

Complete the code to create a client proxy for communication with another microservice.

NestJS
const client = [1].create({ transport: Transport.TCP, options: { port: 3001 } });
Drag options to blanks, or click blank then click option'
AClientProxy
BClientProxyModule
CClientProxyFactory
DClientProxyService
Attempts:
3 left
💡 Hint
Common Mistakes
Using ClientProxy directly which is an interface, not a factory.
Confusing with modules or services that don't create proxies.
3fill in blank
hard

Fix the error in the microservice options to enable independent scaling.

NestJS
const microserviceOptions = { transport: Transport.[1], options: { port: 3001 } };
Drag options to blanks, or click blank then click option'
ATCP
BHTTP
CMQTT
DGRPC
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTP which is not typical for microservices in NestJS.
Selecting MQTT or GRPC without proper setup.
4fill in blank
hard

Fill both blanks to create a microservice that can scale independently and listen on a specific port.

NestJS
const microservice = await NestFactory.createMicroservice(AppModule, { transport: Transport.[1], options: { port: [2] } });
Drag options to blanks, or click blank then click option'
ATCP
BHTTP
C3002
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTP transport which is not typical for NestJS microservices.
Setting a port number that conflicts with other services.
5fill in blank
hard

Fill all three blanks to define a client proxy that connects to a microservice with TCP transport on port 4000.

NestJS
const client = ClientProxyFactory.create({ transport: Transport.[1], options: { host: '[2]', port: [3] } });
Drag options to blanks, or click blank then click option'
AHTTP
Blocalhost
C4000
DTCP
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTP transport which is not typical for microservices.
Using incorrect host or port values.