NPRPC docs

typealias PageHandler

C++

using PageHandler = std::function<std::optional<PageResponse> (const PageRequest &)>

Renders a page in-process, on the HTTP server's own thread.

Returning std::nullopt means "not mine" — the server carries on with static file serving, so a handler can claim /blog and leave /assets/... to the zero-copy file cache.

The call is synchronous and blocks an I/O thread, which suits a template render (microseconds) but not a database round-trip. Anything slow belongs on another thread, with the page handler serving what it already has.

include/nprpc/page_handler.hpp:55