BaşlayınÜcretsiz başlayın

Adding a simple health check endpoint

You want to add a simple health check endpoint to your app.

Bu egzersiz, kursun bir parçasıdır

Deploying AI into Production with FastAPI

Kursa Göz Atın

Egzersiz talimatları

  • Add a GET endpoint at the typical location for health checks.
  • Return a status of "OK".

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

from fastapi import FastAPI

app = FastAPI()

# Create health check endpoint
@app.get("____")
async def get_health():
    # Return status OK
    return {"status": "____"}
Kodu Düzenle ve Çalıştır