# Serving

> route_trie_t matches a path against URI templates, literals before parameters before a trailing wildcard, and answers the endpoint registered for the verb.

17035008

### Routing Requests

`route_trie_t` matches a path against URI templates, literals before parameters before a trailing wildcard, and answers the endpoint registered for the verb:

```cpp
#include "ucall/http/routes.hpp" // `route_trie_t`

namespace uc = unum::ucall;

static int greet = 0; // any address names an endpoint

int main() {
    uc::http::route_trie_t routes {uc::st::default_allocator<uc::http::byte_t> {}};
    if (routes.init() != ucall_status_success_k) return 1;
    // The trie keeps the views it was handed, so a template outlives the trie, as this literal does.
    if (routes.insert("/hello/{name}", ucall_verb_get_k, &greet) != ucall_status_success_k) return 1;
    // A query and a fragment never take part in matching.
    return routes.match("/hello/world?lang=en", ucall_verb_get_k) == &greet ? 0 : 1;
}
```
