일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- fluent python
- guru
- 코어 이더리움 프로그래밍
- 블록체인
- Fast API
- rust
- Thread
- 플랫폼
- dockerfile
- Network
- function
- AWS
- 동시성
- IMAGE
- RabbitMQ
- BAEKJOON
- 파이썬
- Ethereum
- 이더리움
- Algorithm
- Refactoring
- 러스트
- Kubernetes
- docker
- Python
- BlockChain
- 전문가를 위한 파이썬
- 알고리즘
- 백준
- Container
Archives
- Today
- Total
글쓰기 | 방명록 | 관리 |
목록의존성 주입 (1)
Victoree's Blog
[5] Dependency Injection이란? in Fast API
1. 의존성 주입이란? 코드가 작동하고 사용하는데 필요한 종속성을 선언하는 방법이 있음 → 종속성을 코드에 넣는데 필요한 모든 작업을 처리할 수 있음 공통의 코드(중복 코드) 존재 시 데이터베이스 연결 보안, 인증, 등등 [ 간단한 예시 ] from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters(q: Optional[str] = None, skip: int = 0, limit: int = 100): return {"q": q, "skip": skip, "limit": limit} @app.get("/items/") async def read_items(commons: dict = Depends(common_param..
Python/Fast API
2021. 7. 22. 13:59