Twirp_tiny_httpdTwirp for tiny_httpd.
This implements the server end of https://github.com/twitchtv/twirp
module Error = Twirp_core.Errormodule Error_codes = Twirp_core.Error_codesval fail : ?msg:string -> Error_codes.t -> 'aval failf :
Error_codes.t ->
('a, Stdlib.Format.formatter, unit, 'b) format4 ->
'atype handler = | Handler : {rpc : ('req,
Pbrt_services.Value_mode.unary,
'res,
Pbrt_services.Value_mode.unary)
Pbrt_services.Server.rpc;f : 'req -> 'res;} -> handlerA request handler, specialized for Twirp.
val mk_handler :
('req, Pbrt_services.Value_mode.unary, 'res, Pbrt_services.Value_mode.unary)
Pbrt_services.Server.rpc ->
('req -> 'res) ->
handlerCreate a handler.
val add_service :
?middlewares:Tiny_httpd.Middleware.t list ->
?prefix:string option ->
Tiny_httpd.t ->
handler Pbrt_services.Server.t ->
unitadd_service http_server service adds all handlers of service to the given httpd.
As a reminder, a RPC "foo" under service "bar" is routed under prefix/bar/foo using the POST method. The body is either binary, alongside the header "application/protobuf", or JSON, alongside the header "application/json". Errors are always encoded as a JSON object and are indicated by a failing HTTP code (outside of 200…299 range).
RPCs that use streaming (on either the client or server side) will always return "501 unimplemented", because twirp over http 1.1 does not support streaming.