Skip to content

Instantly share code, notes, and snippets.

@padcom
Created January 29, 2012 13:08
Show Gist options
  • Save padcom/1698742 to your computer and use it in GitHub Desktop.
Save padcom/1698742 to your computer and use it in GitHub Desktop.
Grails+Ratpack example
def init = { servletContext ->
new Person(firstName: "John", lastName: "Doe").save(flush: true)
new Person(firstName: "Jane", lastName: "Smith").save(flush: true)
}
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.1"
runtime ":resources:1.1.5"
build ":tomcat:$grailsVersion"
compile ":ratpack:1.0.1"
}
grails.plugin.ratpack.templateRoot='grails-app/ratpack/templates'
<!DOCTYPE html>
<html>
<head>
<title>People</title>
</head>
<body>
<h1>People</h1>
<ul>
<% people.each { person -> %>
<li>${person.firstName} ${person.lastName}</li>
<% } %>
</ul>
</body>
</html>
class Person {
String firstName
String lastName
}
class PersonRatpack {
def urls = {
get("/") {
render "list.html", [ people: Person.list() ]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment