FastAPI'ye Giriş
Matt Eckerle
Software and Data Engineering Leader
HTTP protokolü - birden çok işlem türü
Örnek: https://www.google.com:80/search?q=fastapi
Bir GET isteğinin temel parçaları:
www.google.com80 (varsayılan)/search?q=fastapiEn basit FastAPI uygulaması:
from fastapi import FastAPI# Uygulamayı başlat app = FastAPI()# Kök için GET isteklerini işle @app.get("/") def root(): return {"message": "Hello World"}
Temel cURL seçenekleri:
$ curl -h
Usage: curl [options...] <url>
-v, --verbose Make the operation more talkative
-H, --header <header/@file> Pass custom header(s) to server
-d, --data <data> HTTP POST data
Örnek kullanım:
$ curl http://localhost:8000
{"message":"Hello World"}
Yeni uç nokta:
@app.get("/hello")
def hello(name: str = "Alan"):
return {"message": f"Hello {name}"}
İstekte ad yoksa:

İstekte ad varsa:

FastAPI'ye Giriş