Why is a trie obviously better then a hash map?
You can then easily add features to this structure, like route middlewares at every level in the tree; just apply them while doing the routing.
This also allows you to match route variants easily, ie "foo" and "foo/" are the same, so are "/" and "/index.html". In the same way you can extract query parameters for middleware/handler use.