Skip to content

Instantly share code, notes, and snippets.

@volyx
Created August 18, 2017 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volyx/2c7ce7aeb0cd973f50ae857da6d24d10 to your computer and use it in GitHub Desktop.
Save volyx/2c7ce7aeb0cd973f50ae857da6d24d10 to your computer and use it in GitHub Desktop.
@Grapes([
@Grab('io.ratpack:ratpack-groovy:1.5.0-rc-2'),
@Grab('org.slf4j:slf4j-simple:1.7.25')
])
import static ratpack.groovy.Groovy.ratpack
import ratpack.jackson.*;
class User {
String name;
String surname;
}
ratpack {
handlers {
get {
render Jackson.json(new User(name: "1", surname: "2"))
}
get(":name") {
render "Hello $pathTokens.name!"
}
}
}
@volyx
Copy link
Author

volyx commented Aug 18, 2017

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment