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
More of these please lol just subbed great explanation
You bet! I got you
Great video Eric, I hope to built videos like this soon (to help python community in Spanish), thanks for sharing your knowledge.
You can do it 🙂 Just be ready for a ton of work and a lot of trial and error.
There it is folks, dependency injection. What’s your biggest challenge as a developer right now?
Could you make a video on how to use dependency injection without fastapi?
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
easy concept for spring boot dev
Dependency injection is all over the place in Spring Boot!
I love love love ur videoss❤❤❤
Aww thank you so much 😊
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
Point was modular codebase, if you don't keep seperate function you would copy paste it every where .
Makes easy to understand for everyone.
For once I thought DI is a security vulnerability like sqli 😅
ohhhh no!!! lol