mirror of https://github.com/reiseburo/offtopic
Add a simple build.gradle and ratpack handler to get us started with
This commit is contained in:
parent
1fd1033c26
commit
25b50428db
|
@ -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.+'
|
||||
}
|
|
@ -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'
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue