1. FastAPI 입문: 설치부터 Hello World 까지

# 1 강. FastAPI 입문: 설치부터 Hello World 까지 ## 🎯 학습 목표 - FastAPI 의 특징과 장점 이해 - FastAPI 설치와 첫 애플리케이션 작성 - Swagger UI 자동 문서화 활용 --- ## 1. FastAPI 란? **FastAPI**는 현대적인 파이썬 웹 프레임워크로, 다음과 같은 특징이 있습니다: ### 주요 장점 | 특징 | 설명 | |------|------| | 🚀 **매우 빠름** | Node.js, Go 와 대등한 성능 | | 📝 **자동 문서화** | Swagger UI, ReDoc 자동 생성 | | ✅ **타입 검증** | Python 타입 힌트 기반 자동 검증 | | 🛠️ **IDE 지원** | VSCode, PyCharm 에서 자동완성 | --- ## 2. 설치하기 ```bash # FastAPI 와 서버 (uvicorn) 설치 pip install fastapi "uvicorn[standard]" ``` --- ## 3. 첫 FastAPI 애플리케이션 ```python from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return {"message": "Hello, FastAPI World!"} ``` --- ## 4. 서버 실행 ```bash uvicorn main:app --reload --port 8000 ``` --- ## 5. 자동 생성 API 문서 - **Swagger UI**: http://127.0.0.1:8000/docs - **ReDoc**: http://127.0.0.1:8000/redoc - **OpenAPI JSON**: http://127.0.0.1:8000/openapi.json