Last active
October 11, 2018 18:11
-
-
Save danveloper/caddcf72c79025be4f60 to your computer and use it in GitHub Desktop.
Standalone Ratpack Groovy 0.9.13
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
@GrabResolver(name='netty', root='http://clinker.netty.io/nexus/content/repositories/snapshots') | |
@Grab('io.ratpack:ratpack-groovy:0.9.13-SNAPSHOT') | |
import ratpack.handling.Handler | |
import ratpack.server.* | |
RatpackServer.of { spec -> spec | |
.config(ServerConfig.noBaseDir()) | |
.handler { | |
{ ctx -> ctx.render "Hello World!" } as Handler | |
} | |
} start() |
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
@GrabResolver(name='netty', root='http://clinker.netty.io/nexus/content/repositories/snapshots') | |
@Grab('io.ratpack:ratpack-groovy:0.9.13-SNAPSHOT') | |
import ratpack.handling.Handler | |
import ratpack.server.* | |
Handler base = { ctx -> | |
ctx.render "Hello World!" | |
} | |
RatpackServer.of { spec -> spec | |
.config(ServerConfig.noBaseDir()) | |
.handler { base } | |
} start() |
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
@GrabResolver(name='netty', root='http://clinker.netty.io/nexus/content/repositories/snapshots') | |
@Grab('io.ratpack:ratpack-groovy:0.9.13-SNAPSHOT') | |
import ratpack.handling.Handler | |
import ratpack.server.* | |
Handler base = { ctx -> ctx.render "Hello World!" } | |
Handler route = { ctx -> ctx.render "Welcome $ctx.pathTokens.name!" } | |
RatpackServer.of { spec -> spec | |
.config(ServerConfig.noBaseDir()) | |
.handlers { chain -> chain | |
.get(":name", route) | |
.get(base) | |
} | |
} start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment