- Ability to match static routes
GET /foo/bar
['GET /foo/bar']
- Ability to match a single step in a route
POST /users/{userId}/edit
orPOST /users/{userId:*/}edit
['POST /users/', match('userId', '*/'), '/edit']
- Ability to wildcard the ending of a route
GET /static/{filename:*}
['GET /static/', match('filename', '*')]
- Ability to make the last route step optional
GET /users{userId?:/*/}
['GET /users']
and['GET /users', match('userId', '/*/')]
- Ability to match strings withing a step
GET /coordinates/{lat}-{lng}
orGET /coordinates/{lat:*-}{lng:*}
['GET /coordinates', match('lat', '*-'), '-', match('lng', '*/')]
and['GET /coordinates', match('lat', '*-'), '-', match('lng', '*')]
- Ability to match any request method
{} /rpc
or{:* }/rpc
[match('', '* '), '/rpc']
- Ability to match specific request methods
{method:{GET,POST}} /rpc
['GET /rpc']
and['POST /rpc']
- Ability to specify "one-of" and optional ending wildcard
GET /{:{user,users}}{?:/*}
['GET /user']
and['GET /user', match('', '/*')]
and['GET /users']
and['GET /users', match('', '/*')]
- Ability to match a file name
GET /files/{name}.gif
- Ability to match file name and extension
GET /blobs/{filename}.{extension}
- Expands to:
GET /blobs/{filename:*:.}.{filename:*:/}
- Expands to:
[<name>][?]:[<pattern>]:[<until>]
Template string syntax
Instead of
write
Instead of
write