feat(routing): add api to access key segments by name
This commit is contained in:
parent
f652fa08c1
commit
9dbdb0b089
3 changed files with 45 additions and 4 deletions
|
|
@ -8,13 +8,15 @@
|
|||
|
||||
typedef struct lnm_http_route lnm_http_route;
|
||||
|
||||
typedef struct lnm_http_route_match_segment {
|
||||
size_t start;
|
||||
size_t len;
|
||||
} lnm_http_route_match_segment;
|
||||
|
||||
typedef struct lnm_http_route_match {
|
||||
const lnm_http_route *route;
|
||||
lnm_http_method method;
|
||||
struct {
|
||||
size_t start;
|
||||
size_t len;
|
||||
} key_segments[LNM_HTTP_MAX_KEY_SEGMENTS];
|
||||
lnm_http_route_match_segment key_segments[LNM_HTTP_MAX_KEY_SEGMENTS];
|
||||
} lnm_http_route_match;
|
||||
|
||||
typedef struct lnm_http_router lnm_http_router;
|
||||
|
|
@ -47,4 +49,7 @@ lnm_http_route_err lnm_http_router_route(lnm_http_route_match *out,
|
|||
lnm_http_method method,
|
||||
const char *path);
|
||||
|
||||
lnm_err lnm_http_route_match_get(lnm_http_route_match_segment **out,
|
||||
lnm_http_route_match *match, const char *key);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue