-
-
Save rossabaker/413448 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I think this is possible, if we just ignore the names. | |
// | |
// year = :year, month = :month, day = :day | |
get("/date/:year/:month/:day") { (year, month, day) => | |
<ul> | |
<li>Year: { year }</li> | |
<li>Month: { month }</li> | |
<li>Day: { day }</li> | |
</ul> | |
} | |
// But if we ignore the names, bad things happen: | |
// | |
// year = :monht, month = :day, day = :year | |
get("/date/:month/:day/:year") { (year, month, day) => | |
<ul> | |
<li>Year: { year }</li> | |
<li>Month: { month }</li> | |
<li>Day: { day }</li> | |
</ul> | |
} | |
// Something like this might be able to put the parameters, | |
// in any order, but it's not nearly as nice as what you proposed. | |
// | |
// year = :1, month = :2, day = :3 | |
get("/date/:2/:3/:1") { (year, month, day) => | |
<ul> | |
<li>Year: { year }</li> | |
<li>Month: { month }</li> | |
<li>Day: { day }</li> | |
</ul> | |
} | |
// Or, if it's just based on convention... | |
// | |
// year = first :?, month = second :?, day = third :? | |
get("/date/:?/:?/:?") { (year, month, day) => | |
<ul> | |
<li>Year: { year }</li> | |
<li>Month: { month }</li> | |
<li>Day: { day }</li> | |
</ul> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, this is definitely a feature that we would like to add. Thanks for the idea!