0
0
NestJSframework~10 mins

Redis transport 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 Redis transport from NestJS microservices.

NestJS
import { [1] } from '@nestjs/microservices';
Drag options to blanks, or click blank then click option'
ATransport
BRedisOptions
CRedisTransport
DRedis
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'RedisTransport' which does not exist as an import.
Confusing RedisOptions with the transport enum.
2fill in blank
medium

Complete the code to create a Redis client options object with host 'localhost'.

NestJS
const redisOptions = { transport: Transport.REDIS, options: { host: '[1]' } };
Drag options to blanks, or click blank then click option'
A0.0.0.0
B127.0.0.1
Credis.local
Dlocalhost
Attempts:
3 left
💡 Hint
Common Mistakes
Using IP addresses instead of 'localhost'.
Using invalid hostnames.
3fill in blank
hard

Fix the error in the code to correctly create a Redis microservice client.

NestJS
const client = app.connectMicroservice({ transport: Transport.[1] });
Drag options to blanks, or click blank then click option'
ATCP
BREDIS
CMQTT
DGRPC
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or misspelled transport names.
Using other transport types like TCP or MQTT by mistake.
4fill in blank
hard

Fill both blanks to create a Redis microservice client with port 6379 and password 'secret'.

NestJS
const redisClient = app.connectMicroservice({ transport: Transport.REDIS, options: { port: [1], password: '[2]' } });
Drag options to blanks, or click blank then click option'
A6379
B6380
Csecret
Dpassword123
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong port numbers.
Using incorrect password strings.
5fill in blank
hard

Fill all three blanks to create a Redis microservice client with host 'redis-server', port 6380, and no password.

NestJS
const client = app.connectMicroservice({ transport: Transport.REDIS, options: { host: '[1]', port: [2], password: [3] } });
Drag options to blanks, or click blank then click option'
Alocalhost
B6380
Cnull
Dredis-server
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'localhost' instead of 'redis-server'.
Putting password as a string 'null' instead of null value.