Skip to content

Instantly share code, notes, and snippets.

@solsend2l
Forked from danveloper/a.groovy
Last active August 29, 2015 14:13
Show Gist options
  • Save solsend2l/93b1ba464f060449e9bf to your computer and use it in GitHub Desktop.
Save solsend2l/93b1ba464f060449e9bf to your computer and use it in GitHub Desktop.
@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()
@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()
@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