Library
Module
Module type
Parameter
Class
Class type
('a, 'b) uri
represents a URI - both the path and query, e.g. /home/about/,
/home/contact, /home/contact?name=a&no=123
etc.
A uri is created via usage of wtr.ppx
.
val pp_uri : Format.formatter -> ('a, 'b) uri -> unit
pp_uri fmt uri
pretty prints uri
on to fmt
.
p >- route_handler
creates a route from uri p
and route_handler
.
val match' : 'a t -> string -> 'a option
match t uri
matches a route
to uri
, executes its handler and returns the computed value. None
is returned if uri
is not matched.
module type Decoder = sig ... end
All user defined decoders conform to the module signature decoder.
val create_decoder : name:string -> decode:(string -> 'a option) -> 'a decoder
create_decoder ~name ~decode
creates a user defined decoder uri component. name
is used during the pretty printing of uri
.