Skip to content

Instantly share code, notes, and snippets.

@artyprog
Last active August 29, 2015 14:22
Spark web framework and Tomcat
package org.dev.artyprog;
import static spark.Spark.*;
import spark.Request;
import spark.servlet.SparkApplication;
public class HelloWorld implements SparkApplication {
@Override
public void init() {
get("/hello", (req, res) -> "Hello");
get("/hello/:name/:age", (req, res) -> greet(req));
}
public String greet(Request req) {
return "Hello " + req.params().get(":name") +
" you are " + req.params().get(":age");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment