Created
February 5, 2013 10:42
-
-
Save spinscale/4713657 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def get(String path, Closure ... closures) { | |
spark.Spark.get(createClosureBasedRouteForPath(path, closures)) | |
} | |
private Route createClosureBasedRouteForPath(String path, Closure ... closures) { | |
new Route(path) { | |
def handle(Request request, Response response) { | |
closures*.delegate = this | |
return closures*.call(request, response).findAll { it }.join() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment