Add a simple build.gradle and ratpack handler to get us started with

This commit is contained in:
R. Tyler Croy 2014-11-23 10:11:42 -08:00
parent 1fd1033c26
commit 25b50428db
2 changed files with 52 additions and 0 deletions

18
build.gradle Normal file
View File

@ -0,0 +1,18 @@
plugins {
id "io.ratpack.ratpack-groovy" version "0.9.10"
}
apply plugin: 'groovy'
repositories {
jcenter()
mavenLocal()
}
dependencies {
compile 'io.ratpack:ratpack-handlebars:0.9.10+'
compile 'io.ratpack:ratpack-jackson:0.9.10+'
compile 'io.ratpack:ratpack-codahale-metrics:0.9.10+'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.+'
}

View File

@ -0,0 +1,34 @@
import ratpack.handlebars.HandlebarsModule
import ratpack.jackson.JacksonModule
import static ratpack.handlebars.Template.handlebarsTemplate
import static ratpack.jackson.Jackson.json
import static ratpack.groovy.Groovy.*
import static ratpack.websocket.WebSockets.websocket
ratpack {
bindings {
add new HandlebarsModule()
add new JacksonModule()
}
handlers {
get {
render 'offtopic!'
}
/* set up a demo/dummy websocket listener */
get("ws") { context ->
websocket(context) { ws ->
} connect {
it.onClose {
println "closing"
} onMessage {
"client sent me ${it}"
}
}
}
assets 'public'
}
}