fist
Types
A node in the router tree, representing a route segment.
pub type Node(req_body, res_body) {
Node(
handler: option.Option(
fn(request.Request(req_body), dict.Dict(String, String)) -> response.Response(
res_body,
),
),
static_children: dict.Dict(String, Node(req_body, res_body)),
dynamic_child: option.Option(
#(String, Node(req_body, res_body)),
),
)
}
Constructors
-
Node( handler: option.Option( fn(request.Request(req_body), dict.Dict(String, String)) -> response.Response( res_body, ), ), static_children: dict.Dict(String, Node(req_body, res_body)), dynamic_child: option.Option( #(String, Node(req_body, res_body)), ), )
Values
pub fn delete(
router: Router(req_body, res_body),
path path: String,
to handler: fn(
request.Request(req_body),
dict.Dict(String, String),
) -> response.Response(res_body),
) -> Router(req_body, res_body)
Adds a DELETE route to the router.
pub fn get(
router: Router(req_body, res_body),
path path: String,
to handler: fn(
request.Request(req_body),
dict.Dict(String, String),
) -> response.Response(res_body),
) -> Router(req_body, res_body)
Adds a GET route to the router.
pub fn handle(
router: Router(req_body, res_body),
request: request.Request(req_body),
not_found: fn() -> response.Response(res_body),
) -> response.Response(res_body)
pub fn patch(
router: Router(req_body, res_body),
path path: String,
to handler: fn(
request.Request(req_body),
dict.Dict(String, String),
) -> response.Response(res_body),
) -> Router(req_body, res_body)
Adds a PATCH route to the router.
pub fn post(
router: Router(req_body, res_body),
path path: String,
to handler: fn(
request.Request(req_body),
dict.Dict(String, String),
) -> response.Response(res_body),
) -> Router(req_body, res_body)
Adds a POST route to the router.
pub fn put(
router: Router(req_body, res_body),
path path: String,
to handler: fn(
request.Request(req_body),
dict.Dict(String, String),
) -> response.Response(res_body),
) -> Router(req_body, res_body)
Adds a PUT route to the router.