Get startedGet started for free

Adding a simple health check endpoint

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

This exercise is part of the course

Deploying AI into Production with FastAPI

View Course

Exercise instructions

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

from fastapi import FastAPI

app = FastAPI()

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