Skip to content

Microserver and Groovy

johnmcclean-aol edited this page Dec 2, 2015 · 1 revision

Here is a simple example Groovy application using Microserver

Note the need to provide the current class as a parameter to the call to MicroserverApp and also the need to coerce our closure {->"status-app"} to a Module.

@Rest
@Path("/status")
@Microserver
class StatusGroovy {

	static void main(String[] args){
		
		def app = new MicroserverApp(StatusGroovy,{ -> "status-app"} as Module).start()
		
	}

	@GET
	@Produces("text/plain")
	@Path("/ping")
	public String respondToPing() {
		return "pong!"
	}
}

Some discussion around this here