mailgun/vulcan — pull request #69 by jinzhu (2014-09-27 11:32:37+00:00)
Title: Sort routes before compile into matchers

Hi All,

I got an issue when using the ExpRouter, for example, I have defined two locations:

Location 1's router matcher is `RegexpRoute("/hello")`
Location 2's router matcher is `RegexpRoute("/")`

When ExpRouter compile those two locations into matchers, it haven't sort them, Location 2 may be compiled first, so it will match those `/hello/world` requests that should be matched by Location 1.

This pull request sorted locations by the router matcher's length before compile them into matchers, it should be able to fix above case.