Hcs.Endpoint
hcs · API reference
Global request entry point.
An endpoint composes global plugs and a router into a single Server.request -> Response.t handler suitable for Server.run. Use it for behavior that applies before route selection, such as request IDs, logging, recovery, security headers, or static assets.
type config = {
secret_key_base : string;
health_check : bool;
}val default_config : configtype params_handler = Router.params -> Server.request -> Server.responsetype t = {
config : config;
plugs : Pipeline.t;
router : params_handler Router.t option;
ws_handler : Server.ws_handler option;
}val create : config -> tval plug :
t ->
((Server.request -> Server.response) -> Server.request -> Server.response) ->
tval with_plug :
((Server.request -> Server.response) -> Server.request -> Server.response) ->
t ->
tval plug_pipeline : t -> Pipeline.t -> tval with_pipeline : Pipeline.t -> t -> tval (@>) :
t ->
((Server.request -> Server.response) -> Server.request -> Server.response) ->
tval (@>>) : t -> Pipeline.t -> tval router : t -> params_handler Router.t -> tval websocket : t -> Server.ws_handler -> tval ws_handler : t -> Server.ws_handler optionval not_found_handler : 'a -> Response.tval health_handler : 'a -> Response.tval to_handler : t -> Server.request -> Server.response