Aan de slagGa gratis aan de slag

Adding a simple health check endpoint

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

Deze oefening maakt deel uit van de cursus

Deploying AI into Production with FastAPI

Cursus bekijken

Oefeninstructies

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

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

from fastapi import FastAPI

app = FastAPI()

# Create health check endpoint
@app.get("____")
async def get_health():
    # Return status OK
    return {"status": "____"}
Code bewerken en uitvoeren