Slide 122
Slide 122 text
Golo augment Vert-x
augment io.vertx.ext.web.Router {
function get = |this, uri, handler| {
return this: get(uri): handler(handler)
}
function post = |this, uri, handler| {
return this: post(uri): handler(handler)
}
}
augment io.vertx.core.http.HttpServerRequest {
function param = |this, paramName| -> this: getParam(paramName)
}
augment io.vertx.core.http.HttpServerResponse {
function djson = |this| {
this: putHeader("content-type", "application/json;charset=UTF-8")
return DynamicObject(): define("send", |self| {
this: end(JSON.stringify(self), "UTF-8")
})
}
}