Skip to content

Instantly share code, notes, and snippets.

@ldaley
Created December 13, 2013 12:49
Show Gist options
  • Save ldaley/7943781 to your computer and use it in GitHub Desktop.
Save ldaley/7943781 to your computer and use it in GitHub Desktop.
Self bootstrapped Ratpack app
import ratpack.launch.LaunchConfigBuilder
import ratpack.server.RatpackServerBuilder
import static ratpack.groovy.Groovy.chain
def launchConfig = LaunchConfigBuilder.
baseDir(new File("some/path")).
port(1234).
build {
chain(it) {
get {
render "Hello world!"
}
}
}
def server = RatpackServerBuilder.build(launchConfig)
server.start()
try {
new URL("http://localhost:1234").text == "Hello world!"
} finally {
server.stop()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment