Skip to content

REST API Routes

REST API endpoints for the DDFR face recognition application.

Overview

The REST API provides standard HTTP endpoints for application interaction. Currently, the API includes a simple health check endpoint. Additional endpoints for person management and face recognition operations may be added in future versions.

Base URL

All API endpoints are prefixed with the application base URL: - Development: http://localhost:8000 - Production: Configure via APP_HOST and APP_PORT environment variables

CORS Configuration

The API is configured with CORS middleware that allows: - All origins (*) - All methods (*) - All headers (*) - Credentials enabled

This configuration is suitable for development. For production, consider restricting allowed origins.

Endpoints

Health Check

GET /

Returns a simple greeting message indicating the server is active.

Request:

GET / HTTP/1.1
Host: localhost:8000

Response:

{
  "message": "Hello World"
}

Status Codes: - 200 OK: Server is running and responding

Use Cases: - Health check for monitoring systems - Verify API server availability - Simple connectivity test

API Reference

app.routers.route.router module-attribute

router = APIRouter()

app.routers.route.home async

home()

Return home endpoint greeting message.

Returns:

Name Type Description
dict dict

A dictionary containing a greeting message.

Source code in backend/app/routers/route.py
@router.get("/")
async def home() -> dict:
    """Return home endpoint greeting message.

    Returns:
        dict: A dictionary containing a greeting message.

    """
    return {"message": "Hello World"}