Dependency Injection Explained Like You’re 5 (with FastAPI Examples)

Поділитися
Вставка
  • Опубліковано 22 вер 2024
  • Learning dependency injection can be hard. In this simple FastAPI tutorial we will go over dependency injection and that Depends Keyword.
    💻 Repository: www.codingwith...
    Want more free repositories? www.codingwith...
    🎥 React + FastAPI: • How to build a React +...
    🎥 AWS Lambda + FastAPI: • Deploy FastAPI on AWS ...
    🎥 MongoDB + FastAPI: • Unlocking the Power of...
    🎥 MySQL + FastAPI: • How to build a FastAPI...
    🎥 PostgreSQL + FastAPI: • How to build a FastAPI...
    🎓 Courses can be found:
    FastAPI Beginner & Advanced: www.udemy.com/...
    Learn Chatbot Development: www.udemy.com/...
    👨‍💻 Hi, I am Eric!👨‍💻
    Hey! I’m a seasoned developer and Cloud enthusiast. I love sharing my knowledge and helping others to discover the exciting world of programming and cloud technologies. For more tutorials, tips, and tech magic, don’t forget to hit that subscribe button and ring the bell for notifications!
    🙏 Support The Channel 🙏
    If you found this tutorial helpful, please give it a thumbs up 👍, comment, and share it with your network 🌍
    #fastapi #dependencyinjection #python

КОМЕНТАРІ • 15

  • @Wolfci
    @Wolfci 2 дні тому

    More of these please lol just subbed great explanation

  • @CodePythonPro
    @CodePythonPro 2 дні тому

    Great video Eric, I hope to built videos like this soon (to help python community in Spanish), thanks for sharing your knowledge.

    • @codingwithroby
      @codingwithroby  2 дні тому +1

      You can do it 🙂 Just be ready for a ton of work and a lot of trial and error.

  • @codingwithroby
    @codingwithroby  3 дні тому +1

    There it is folks, dependency injection. What’s your biggest challenge as a developer right now?

  • @wait4015
    @wait4015 2 дні тому

    Could you make a video on how to use dependency injection without fastapi?

    • @codingwithroby
      @codingwithroby  2 дні тому

      Fairly similar - easy way is to initialize the object you will need in the class and then call directly.
      class FrameworkClass():
      def __init__(self, func):
      self.func = func
      def do_the_job(self):
      # some stuff
      self.func()
      def my_func():
      # do whatever here

  • @moinundin1221
    @moinundin1221 3 дні тому +1

    easy concept for spring boot dev

    • @codingwithroby
      @codingwithroby  3 дні тому +1

      Dependency injection is all over the place in Spring Boot!

  • @krishnaagarwal7934
    @krishnaagarwal7934 2 дні тому

    I love love love ur videoss❤❤❤

  • @ankitmoura1467
    @ankitmoura1467 День тому

    ok so whole point is to save resources and not create new instance on every api call ryt? but like when we create a new function which returns the new instance for us won't that fn be called on every api call and return a new instance i might be wrong but it feels like we r doing same thing with extra steps help?. also great content

    • @yashasmn245
      @yashasmn245 День тому

      Point was modular codebase, if you don't keep seperate function you would copy paste it every where .
      Makes easy to understand for everyone.

  • @shafiq_ramli
    @shafiq_ramli 2 дні тому

    For once I thought DI is a security vulnerability like sqli 😅