Skip to content

Instantly share code, notes, and snippets.

@dclucas
Created May 11, 2015 12:44
Show Gist options
  • Save dclucas/c070ea733b5490827e0f to your computer and use it in GitHub Desktop.
Save dclucas/c070ea733b5490827e0f to your computer and use it in GitHub Desktop.
Rough DSL usage draft for route condiguration
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