Man, my friend, the channel's author, I really appreciate what you do, it's helpful, it's useful, thank you so much, you're the best, the video helped me to realize how all this stuff works and I am grateful for your explanation. Keep working, keep doing that. Nestjs and whatever. My endless respect.
🎉Thanks Buddy... You nailed it man..... All nest js concepts were explained simple and Clean way.. This playlist worth who are starting nestjs and to be master in it... The lot of concepts included with the flows... Great work man
Thank you very much, you explained NestJS the best, I've looked all over youtube and even paid tutorials, but still you explained it the best, I'm so grateful 👏💪
Wherever we have to use Guard, we have to inject JwtService and UserService right? Isn't this boring to import all these two services only for a single functionality, is there any different option to this?
It depends on the specific goals and responsibilities of the guards.. If your guard simply checks for a user's role from a payload, then no.. If your guard is checking for the existence of a field in your request, you also wouldn't need to inject those services.. However, if your guard's role is to verify a token.. then yes, you would need to inject the JwtService to perform this action.. If you don't care about fetching the users data, you wouldn't need to inject the UserService.. It all depends on what you need and what you depend on (it's dependency injection in the end of the day).. Hope this helps
@@Computerix Yea you are correct but EOD I have to import JwtService and UserService in all of my modules except the auth service with a SignIn and SignOut route, except these two (maybe 1 or 2 more) routes I want my guard to be in all of the different modules, so what i'm asking is there any trick to add guard in a couple of modules together at a time? and not just manually add them in every single module!
@@kedarvyashelios regarding the JwtService, you can make it globally available whenever you're registering the JwtModule in app.module.ts (just set isGlobal: true), and you will be able to inject it everywhere, without having to import it again.. For the UsersService and any other service that you end up using in different places (for dependency injection), instead of importing the UsersModule (containing this UsersService provider), you could make the UsersService a global provider.. You can : 1- Create a Global Module (you can call it anything, for example: GlobalModule), and you need to use @Global() as a decorator.. 2- Register all the services you want to use globally, inside the providers array 3- Add them to the export array, so that any module who imports this GlobalModule, will have access to these services 4- Add the GlobalModule to the imports array in app.module.ts This way, you can inject UsersService or any other service you need available globally, without the need to import UsersModule (or whatever module they are registered in) every single time Code example: import { Module, Global } from '@nestjs/common'; import { UploadService } from './common/services/upload.service'; //Made global module to add providers that can be used throughout the app @Global() @Module({ imports: [], providers: [UploadService], exports: [UploadService], }) export class GlobalModule {} and import this GlobalModule in app.module.ts Congrats, you can now use UploadService anywhere in your app, without any extra imports !
Man, my friend, the channel's author, I really appreciate what you do, it's helpful, it's useful, thank you so much, you're the best, the video helped me to realize how all this stuff works and I am grateful for your explanation.
Keep working, keep doing that. Nestjs and whatever.
My endless respect.
Thank you so much for your comment ! I'm glad I was able to help you. New videos coming soon!
🎉Thanks Buddy... You nailed it man..... All nest js concepts were explained simple and Clean way.. This playlist worth who are starting nestjs and to be master in it... The lot of concepts included with the flows... Great work man
Thanks for your kind words and donation ! I'm glad I was able to help!
@@Computerix you can put it on udemy or Coursera too man with little extra steps....
@@samsolomonraja I've been considering this for a while.. sadly, I don't have much time these days.. maybe in the future !
Thank you very much, you explained NestJS the best, I've looked all over youtube and even paid tutorials, but still you explained it the best, I'm so grateful 👏💪
Thank you so much for your comment! I'm so happy my content helped you 😁
watching for the first time looks difficult but you explain it very efficiently 👏
Thanks 💚
I'm glad I was of help !
THANK YOU SO MUCH!!!!! I was stuck on the role-route-permission thing for days and you helped me figure it out, thanks!!!
you're welcome :)
really love the way you explain
❤
Thank you!
I'm watching from syria and i love this video, thsnks brother, i'm waiting a next videos .
I appreciate your support !
great and simple!
keep this good work bro
thanks !
Wherever we have to use Guard, we have to inject JwtService and UserService right?
Isn't this boring to import all these two services only for a single functionality, is there any different option to this?
It depends on the specific goals and responsibilities of the guards.. If your guard simply checks for a user's role from a payload, then no..
If your guard is checking for the existence of a field in your request, you also wouldn't need to inject those services..
However, if your guard's role is to verify a token.. then yes, you would need to inject the JwtService to perform this action..
If you don't care about fetching the users data, you wouldn't need to inject the UserService..
It all depends on what you need and what you depend on (it's dependency injection in the end of the day).. Hope this helps
@@Computerix Yea you are correct but EOD I have to import JwtService and UserService in all of my modules except the auth service with a SignIn and SignOut route, except these two (maybe 1 or 2 more) routes I want my guard to be in all of the different modules, so what i'm asking is there any trick to add guard in a couple of modules together at a time? and not just manually add them in every single module!
@@kedarvyashelios regarding the JwtService, you can make it globally available whenever you're registering the JwtModule in app.module.ts (just set isGlobal: true), and you will be able to inject it everywhere, without having to import it again..
For the UsersService and any other service that you end up using in different places (for dependency injection), instead of importing the UsersModule (containing this UsersService provider), you could make the UsersService a global provider..
You can :
1- Create a Global Module (you can call it anything, for example: GlobalModule), and you need to use @Global() as a decorator..
2- Register all the services you want to use globally, inside the providers array
3- Add them to the export array, so that any module who imports this GlobalModule, will have access to these services
4- Add the GlobalModule to the imports array in app.module.ts
This way, you can inject UsersService or any other service you need available globally, without the need to import UsersModule (or whatever module they are registered in) every single time
Code example:
import { Module, Global } from '@nestjs/common';
import { UploadService } from './common/services/upload.service';
//Made global module to add providers that can be used throughout the app
@Global()
@Module({
imports: [],
providers: [UploadService],
exports: [UploadService],
})
export class GlobalModule {}
and import this GlobalModule in app.module.ts
Congrats, you can now use UploadService anywhere in your app, without any extra imports !
nest have another way with passport and stretagies, which is the better?
well done sir.
Glad you enjoyed it!
where is the source code?
Hi can u create video
RabbitMQ - RPC with NestJS (request-reply pattern)
and can u show NestJS with Prisma
And your videos are excellent keep working
Thank you! Will keep that in mind
you sound lebanese ! ace bro
Appreciate it!
🇱🇧👀