server {
get('/') {
render 'Hello World!'
}
get('/spanish') {
render 'Hola Mundo!'
}
get('/salute/:name') {
render "Hello ${req.params.name}!"
}
}.start(3000)
trait DomFinder {
@GsNative
private List selectItems(selector) {
}
def propertyMissing(String name) {
selectItems("#$name") ?: selectItems(".$name")
}
}
presenter.foo.collect { it.value() }
.findAll { it.contains 'bar' }
.sort { it.size() }
ul {
languages.each {
li(class: it.style) {
yield it.name.capitalize()
}
if (it.photo) {
img it.photo
}
}
}
class TodoController implements AngularController {
def todos = [[text:'learn grooscript', done: true]]
def addTodo() {
scope.todos << [text: scope.todoText, done: false]
scope.todoText = ''
}
def remaining() {
scope.todos.count { it.done }
}
def archive() {
scope.todos = todos.findAll { !it.done }
}
}