How Echo routing works

As mentioned previously, Echo employs a Radix Tree data structure and search algorithm to find the correct handler for a given resource identifier. A Radix Tree is a prefix tree, where each parent node in the tree represents a prefix of the child node. In our use case, since we are obviously performing string matching, a prefix tree is the appropriate tool for the job. The following is an extremely simplified diagram that explains how a Radix Tree works for our book-long project:

The preceding diagram assumes the following routes were added to our project, which can be seen in our sample code located at: $GOPATH/src/github.com/PacktPublishing/Echo-Essentials/chapter3/cmd/service/main.go ...

Get Echo Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.