---
title: "content.addServeHandler()"
description: "Register a custom section on handler(), reachable under basePath."
canonical_url: "https://content.comark.dev/reference/content/add-serve-handler"
---
# content.addServeHandler()

> Register a custom section on handler(), reachable under basePath.

## `content.addServeHandler(section, handler)`

Registers a custom section on [`handler()`](https://content.comark.dev/reference/content/handler), reachable at `<basePath>/<section>`. This is the recommended way to extend the data surface; pair it with a matching client plugin.

**Parameters:**

- `section`: the first path segment to match (for example `'search'`).
- `handler`: `(request: Request) => Promise<Response>`.

**Returns:** `void`

```ts
content.addServeHandler('search-sections', () => jsonResponse(buildSearchSections(content)))
```

## Usage

```ts [usage.ts]
content.addServeHandler('search-sections', () => jsonResponse(buildSearchSections(content)))
```


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
