NestJs - Service Providers & Dependency Injection [03]

Поділитися
Вставка
  • Опубліковано 22 жов 2024

КОМЕНТАРІ • 16

  • @MohamedSaqr
    @MohamedSaqr 10 місяців тому +1

    Excellent explanation. Keep going. 👌

  • @aryanrahman3212
    @aryanrahman3212 5 місяців тому

    Very good explanation, may God do good to you!

    • @Computerix
      @Computerix  5 місяців тому

      Thanks! God bless you

  • @piyumalchandrarathna5169
    @piyumalchandrarathna5169 4 місяці тому

    great explanation.❤

  • @asharma741
    @asharma741 Рік тому

    very well explained!!😀

  • @mahaburrahman1666
    @mahaburrahman1666 9 місяців тому

    Greate explanation, take love from heart

  • @dd3715
    @dd3715 Рік тому

    thank bro, I really needed this 🤗

  • @brightertomorrow3343
    @brightertomorrow3343 Рік тому

    Great keep going champ ❤

  • @omarps6622
    @omarps6622 8 місяців тому

    keep it up bro ✌

  • @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  Рік тому +4

      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 9 місяців тому +1

      @@Computerix Greate explanation,