content.addServeHandler()

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

content.addServeHandler(section, handler)

Registers a custom section on 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 (e.g. 'search').
  • handler: (request: Request) => Promise<Response>.

Returns: void

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

Usage

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