Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
RoutesSourceTyped routing for OCaml. Routes provides combinators for adding typed routing to OCaml applications. The core library will be independent of any particular web framework or runtime.
'a t represents a path parameter of type 'a.
'a router represents the internal router data type, where each route can potentially return a value of type 'a .
apply f t applies a function f that is wrapped inside a 'a t context to a path param parser. f <*> p is the same as f >>= fun f -> map ~f p
s word returns a path parser that matches word exactly and then discards the result.
one_of accepts a list of route parsers and converts into a router.
with_method accepts a list of routes + http methods and converts it into a router. This will also group methods based on the Http verb. If there are multiple route definitions that overlap and are potential matches, the one defined first will be returned.
match' runs the router against the provided target url.
match_with_method is used to run the router. It accepts a target url string, HTTP method verb a request of any type (which is forwarded as the last parameter to the handler functions). If a route matches it runs the attached handler and returns the result.