एक साधारण health check endpoint जोड़ना
आप अपनी ऐप में एक साधारण health check endpoint जोड़ना चाहते हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
FastAPI के साथ प्रोडक्शन में AI डिप्लॉय करना
अभ्यास निर्देश
- हेल्थ चेक के लिए सामान्य लोकेशन पर एक GET endpoint जोड़ें.
"OK"का status रिटर्न करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
from fastapi import FastAPI
app = FastAPI()
# Create health check endpoint
@app.get("____")
async def get_health():
# Return status OK
return {"status": "____"}