liveBook · Manning

Handler

As explained in Machine Learning System Design

A software component that receives and processes requests made through an API.

An HTTP API handler receives requests and returns responses through a structured interface. In a search service, it parses the request, passes it to the underlying API, wraps the response as JSON, and handles errors; it contains no business logic. section 13.5.2 section 13.5.1

Keep the handler’s role clear:

  • Accept product inputs such as a query and optional filters, alongside technical parameters such as version, limit, and request ID. section 13.5.2
  • Leave search operations, such as filtering candidates and ranking results, to underlying services. section 13.5.2
```
GET /search?query=<query_string>&filters=<filters>&version=<version>
&limit=<limit>&request_id=<request_id>
```

Example search endpoint with query, filters, and technical parameters. section 13.5.2

```
{
    "results": [
        {
            "id": <photo_id>,
            "score": <score>
        },
        ...
    ]
}
```

Example JSON response containing photo IDs and relevance scores. section 13.5.2

How Machine Learning System Design covers it

How deep it goes
Explains request parsing, delegation, JSON response wrapping, and error handling, while explicitly excluding business logic.
Examples
Uses a photo-search endpoint with optional filters and a JSON response of photo IDs and relevance scores.
What you can do after
Build it from scratch by parsing requests, delegating work, formatting JSON responses, and handling errors.
How it connects
Connects HTTP APIs and JSON responses to backend services and vector databases.

Also explained in

Compare how 22 books explain handler →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning System Design. The section links point to the parts of the book it draws on.