Created
May 25, 2010 17:38
-
-
Save paulosuzart/413430 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
GET "/home/index" { (name, age) => | |
println("my name is " + name + ". Im " + age) | |
} | |
// We need it in scala | |
//rossabaker's Step is wonderful. I would like to see 'params(..)' go away like: | |
get("/date/:year/:month/:day") { (year, month, day) => | |
<ul> | |
<li>Year: { year }</li> | |
<li>Month: { month }</li> | |
<li>Day: { day }</li> | |
</ul> | |
} |
Huumm. Sure, (year, month, day) can be a convention to appear in the same order as the URL. Or maybe annotated params. I'll play with it.
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think something like this might be possible with positional parameters. It could parse the URL and pass three parameters in order to your closure. I'm not sure how it would match the parameter names to the variable names -- that's more of dynamic language trick.