Monday, December 5, 2011

Gretty

@GrabResolver(name='gretty', 
  root='http://groovypp.artifactoryonline.com/groovypp/libs-releases-local')
@Grab('org.mbte.groovypp:gretty:0.4.302') 
import org.mbte.gretty.httpserver.* 

GrettyServer server = []
server.groovy = [ 
    localAddress: new InetSocketAddress("localhost", 8080), 
    defaultHandler: { 
        response.redirect "/" 
    }, 
    "/:name": {
        get {
            response.text = "Hello ${request.parameters['name']}"
        } 
    } 
] 
server.start()

//see: https://github.com/groovypp/gretty/wiki/Getting-Started

see: Gretty, article

No comments:

Post a Comment