# Quick Start
You have your REST API ready to serve JSON in less than ten lines of code
What is ctx -> HttpResponse.of("Pong") ?
This is called Functional Interface - a shorthand syntax of Java 8, if you use Java 7 and before, you can write like this:
server.use("/", new Handler() {
@Override
public HttpResponse handleFunc(Context context) throws Exception {
return HttpResponse.of("Hello World!");
}
});
Okay, then what is gson::toJson ?
It's another sugar syntax called Double Colon Operator
The code above can be written without Double Colon Operator like this:
server.useTransformer(response -> gson.toJson(response));
or without Double Colon Operator and Functional Interface should be as follows:
server.useTransformer(new RequestTransformer() {
@Override
public String render(Object model) {
return gson.toJson(model);
}
});
← Installation Routes →