Skip to content

Instantly share code, notes, and snippets.

server = Server.make_dispatch(Server.Filter.path(["app1"]),
| {~path ...} -> Resource.html("Test", <>This is application 1, with path {List.to_string(path)}</>)
)
server = Server.make_dispatch(Server.Filter.path(["app2"]),
| {~path ...} -> Resource.html("Test", <>This is application 2, with path {List.to_string(path)}</>)
)
server = Server.simple_dispatch(
| {~path ...} -> Resource.html("Test", <>No application, this is {List.to_string(path)}</>)
type Uri.relative =
/**Relative URI*/
{ path : list(string)
; fragment : option(string)
; query : list((string, string))
}
type Server.filter = private(Uri.relative -> option(Uri.relative))
remove_path(path: list(string)): Server.filter =