Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
The `Route module helps with building routes
type route = [
| `String of string
| `Int of string
| `Float of string
| `Path of string
| `Match of string * string
| `Route of route list
]
The route type allows for URL routes to be built using strong types
type params = (string, route) Stdlib.Hashtbl.t
The type that contains parsed URL parameters
val route_cache : (route, Str.regexp) Stdlib.Hashtbl.t
The route cache allows the route -> regexp process to be memoized
val to_string : route -> string
Convert a route to string
val to_regexp : route -> Str.regexp
Convert a route to regexp
val of_string :
string ->
[> `Route of
[> `Float of string
| `Int of string
| `Match of string * string
| `Path of string
| `String of string ]
list ]
"/user/<name:int>" -> `Path "user", `Int "name"
val variables :
[< `Float of 'b
| `Int of 'c
| `Match of 'd
| `Path of 'e
| `Route of 'a list
| `String of 'f Route ] as 'a ->
'a list
Returns a list of variables found in a route
val matches : route -> string -> bool
Check to see if a string matches the route's regexp
val params :
[< `Float of 'b
| `Int of 'b
| `Match of 'b * 'c
| `Path of 'd
| `Route of 'a list
| `String of 'b Route ] as 'a ->
string ->
('b, [> `Float of string | `Int of string | `String of string ])
Stdlib.Hashtbl.t
Get a parameters after a successful route match
val int :
('a,
[> `Float of string
| `Int of string
| `Match of 'b * string
| `String of string ])
Stdlib.Hashtbl.t ->
'a ->
int
Get a single parameter as int by name
val float :
('a,
[> `Float of string
| `Int of string
| `Match of 'b * string
| `String of string ])
Stdlib.Hashtbl.t ->
'a ->
float
Get a single parameter as float by name
val string :
('a,
[> `Float of string
| `Int of string
| `Match of 'b * string
| `String of string ])
Stdlib.Hashtbl.t ->
'a ->
string
Get a single parameter as string by name
val json_of_route :
[< `Float of string
| `Int of string
| `Match of 'b * string
| `Path of string
| `Route of 'a list
| `String of string ] as 'a ->
Ezjsonm.value
val to_json :
('a,
[< `Float of string
| `Int of string
| `Match of 'c * string
| `Path of string
| `Route of 'b list
| `String of string ] as 'b)
Stdlib.Hashtbl.t ->
[> `O of ('a * Ezjsonm.value) list ]