Httpz_serverHttpz Server - Server-side HTTP utilities.
This module provides server-specific functionality built on top of the core Httpz library. It includes:
Route: Segment-based routing with type-safe patterns and trie dispatchFor HTTP protocol parsing and serialization, see Httpz. For Eio-based connection handling, see Httpz_eio.
open Httpz_server.Route
let routes = of_list [
get_ [] (fun _ctx respond -> html respond "Welcome!");
get ("users" / seg End) (fun (user_id, ()) _ctx respond ->
html respond (Printf.sprintf "User: %s" user_id));
get ("static" / tail) (fun path _ctx respond ->
serve_file (String.concat "/" path) respond);
]See Route for comprehensive routing documentation.
module Route : sig ... endSegment-based HTTP routing.