No video

NestJs - Service Providers & Dependency Injection [03]

We're going to see how to create a Service in Nest. How services can be treated as providers, and what the roles of providers are. We will see what dependency injection is, how it's handled in Nest, and the relation between providers and dependency injection.
We will also cover custom providers.
Timestamps:
---------------------
0:00- Introduction
0:29- The different layers of a Backend application
1:53- Providers and @Injectable
2:59- Generating a new Controller
3:43- Creating our Customer Service Provider
4:07- Injecting the Provider as a Dependency
5:30- Adding some logic to our Service
5:59- Creating Handlers in our Controller
7:20- Common Dependancy Injection errors
9:45- Steps followed to create a provider
11:15- Using a Provider outside of its module
15:26- Provider Scopes
16:21- How does Nest handle Singleton Providers ?
17:18- Dependency Injection behind the scenes
19:33- Custom Providers and Tokens
22:30- String Based Token Names
24:13- Using Dynamic Providers
25:50- Recap

Пікірлер: 16

  • @piyumalchandrarathna5169
    @piyumalchandrarathna51692 ай бұрын

    great explanation.❤

  • @MohamedSaqr
    @MohamedSaqr7 ай бұрын

    Excellent explanation. Keep going. 👌

  • @aryanrahman3212
    @aryanrahman32123 ай бұрын

    Very good explanation, may God do good to you!

  • @Computerix

    @Computerix

    3 ай бұрын

    Thanks! God bless you

  • @asharma741
    @asharma741 Жыл бұрын

    very well explained!!😀

  • @dd3715
    @dd3715 Жыл бұрын

    thank bro, I really needed this 🤗

  • @Computerix

    @Computerix

    Жыл бұрын

    You're welcome :)

  • @mahaburrahman1666
    @mahaburrahman16667 ай бұрын

    Greate explanation, take love from heart

  • @Computerix

    @Computerix

    7 ай бұрын

    Thanks !

  • @brightertomorrow3343
    @brightertomorrow3343 Жыл бұрын

    Great keep going champ ❤

  • @Computerix

    @Computerix

    Жыл бұрын

    Thank you !

  • @omarps6622
    @omarps66226 ай бұрын

    keep it up bro ✌

  • @Computerix

    @Computerix

    6 ай бұрын

    Thank you !

  • @RayhanHibatullah
    @RayhanHibatullah Жыл бұрын

    what is the diffrences between services and providers? both have @injectable and seems to have the same function (to be injected in something). I am from angular background so I kind a confused (or not)?

  • @Computerix

    @Computerix

    Жыл бұрын

    A provider is something that can be injected (could be a class, or an object, or even a number). When a class is decorated with @Injectable, we know that it's a provider and can be injected and used as a dependancy. It could be a service, or a helper class etc.. A service is used to handle business logic, to keep your application clean and seperated. So instead of putting all your logic in your controller for example, you create a service that takes care of the business logic to keep your code clean and seperared. It's a good idea to decorate a service with @Injectable (marking that specific service as a provider) because that way, we can take advantage of dependancy injection to use it in our application. In this example, we can see that the service is a provider. But a provider doesn't have to be a service. I hope it made things clearer !

  • @YanLoonG13

    @YanLoonG13

    7 ай бұрын

    @@Computerix Greate explanation,