dependencies {
implementation 'com.hackorama.m.core:mcore:0.1.0'
}
|
new Service() {
private Response hello(Request request) {
if (request.getPathParams().containsKey("name")) {
return new Response("Hello " + request.getPathParams().get("name"));
}
return new Response("Hello world");
}
@Override
public void configure() {
GET("/hello", this::hello);
GET("/hello/{name}", this::hello);
}
}.configureUsing(new SparkServer("Hello")).start();
|