Created
December 13, 2013 12:49
-
-
Save ldaley/7943781 to your computer and use it in GitHub Desktop.
Self bootstrapped Ratpack app
This file contains 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
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