Handle optional trailing slashes in route definition.

Prior to this commit, using the common pattern of appending a `/?' to routes in order to make them insensitive to the presence of a trailing slash in the request could result in the generation of paths like `/path/??key=value'.
Merge pull request #2 from al/optional_trailing_slashes

Handle optional trailing slashes in route definition.