Annotation-driven route configuration for Spark.
First, annotate a route, filter or exception handler with the annotations in io.drakon.spark.autorouter.Routes
:
import static io.drakon.spark.autorouter.Routes.*;
public class Example {
@GET(path = "/")
public static Object index(spark.Request request, spark.Response response) {
return "Hello, world!";
}
}
Then call the router in your application init code:
import io.drakon.spark.autorouter.Autorouter;
public class Main {
public static void main(String[] argv) {
Autorouter router = new Autorouter("your.pkg.here");
router.route();
}
}
Done!
- Java Development Kit 8+ (for compile and runtime)
- Intellij IDEA if developing this project
Jars, sources and JavaDocs are available on the Tethys Maven server. For Gradle dependencies block:
maven {
name 'Tethys'
url 'http://tethys.drakon.io/maven'
}
The current artifact ID is:
- Group:
io.drakon.spark
- ID:
autorouter
- Version:
0.0.7
Available classifiers:
sources
javadoc