request.h¶
The request.h module provides functions for interacting with
mn_request objects. Learn more at Requests.
API¶
-
struct mn_query_param¶
A single query param. Given e.g.
abc=def, thekeycorresponds toabcwhereasvaluecorresponds todef.
-
struct mn_request¶
A client request.
-
struct mn_query_param query[MN_REQUEST_MAX_QUERY_PARAMS]¶
The query parameters sent by the client. There are a total of
query_countvalid key/value parameters set.
-
size_t query_count¶
The number of query parameters sent by the client.
-
struct mn_view captures[MN_REQUEST_MAX_CAPTURES]¶
-
size_t capture_count¶
The number of string fragments captured.
-
struct mn_query_param query[MN_REQUEST_MAX_QUERY_PARAMS]¶
- typedef struct mn_status mn_route_handler_t(
- struct mn_request const,
- struct mn_response *const
A type alias for a user-defined handler function.
-
struct mn_route¶
A route. These are pattern-matched against client requests. For more information, refer to Routing. The following is a typical example of how a router might be defined:
static struct mn_route route_root; static struct mn_route route_abc; static struct mn_route route_def; static struct mn_route route_root = { .method = MN_METHOD_GET, .pattern = mn_str_lit("/"), .handler = handle_root, .next = &route_abc, }; static struct mn_route route_abc = { .method = MN_METHOD_GET, .pattern = mn_str_lit("/abc"), .handler = handle_abc, .next = &route_def, }; static struct mn_route route_def = { .method = MN_METHOD_GET, .pattern = mn_str_lit("/def"), .handler = handle_def, };
-
mn_route_handler_t *handler¶
The user-defined handler function to be called on a successful match.
-
mn_route_handler_t *handler¶