Created
May 11, 2015 12:44
-
-
Save dclucas/c070ea733b5490827e0f to your computer and use it in GitHub Desktop.
Rough DSL usage draft for route condiguration
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
def defineRoute(routeBuilder) { | |
routeBuilder.categories { | |
schema { | |
properties { | |
name { | |
type string, | |
description "a name" | |
} | |
links { | |
brand "brands" | |
} | |
} | |
required ['name'] | |
name "Category" | |
} | |
get { req, res -> | |
"people.get logic goes here" | |
} | |
post { req, res, data -> | |
"people.get logic goes here" | |
} | |
validate { | |
get { req, res -> halt 400} | |
} | |
authorize { | |
get { req, res -> halt 403} | |
} | |
document { | |
post { docs -> docs.summary = "Overridden summary for post"; doc } | |
… | |
} | |
"{id}" { | |
get { req, res -> | |
"people/{id}/" | |
} | |
patch { req, res, data -> | |
"people/{id}/" | |
} | |
delete { req, res -> | |
"people/{id}/" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment