Skip to content

Instantly share code, notes, and snippets.

@paulosuzart
Created May 25, 2010 17:38
Show Gist options
  • Save paulosuzart/413430 to your computer and use it in GitHub Desktop.
Save paulosuzart/413430 to your computer and use it in GitHub Desktop.
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>
}
@rossabaker
Copy link

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.

@paulosuzart
Copy link
Author

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