Created
January 29, 2012 13:08
-
-
Save padcom/1698742 to your computer and use it in GitHub Desktop.
Grails+Ratpack example
This file contains hidden or 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
| def init = { servletContext -> | |
| new Person(firstName: "John", lastName: "Doe").save(flush: true) | |
| new Person(firstName: "Jane", lastName: "Smith").save(flush: true) | |
| } |
This file contains hidden or 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
| plugins { | |
| runtime ":hibernate:$grailsVersion" | |
| runtime ":jquery:1.7.1" | |
| runtime ":resources:1.1.5" | |
| build ":tomcat:$grailsVersion" | |
| compile ":ratpack:1.0.1" | |
| } |
This file contains hidden or 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
| grails.plugin.ratpack.templateRoot='grails-app/ratpack/templates' |
This file contains hidden or 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
| <!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> |
This file contains hidden or 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
| class Person { | |
| String firstName | |
| String lastName | |
| } |
This file contains hidden or 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
| 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