Routing

No more manually declared routes. Use annotations directly on your methods.

Available annotations
@GET(value = "/articles", name = "articles.index")
@POST(value = "/articles", name = "articles.store")
@PUT(value = "/articles/:id", name = "articles.update")
@DELETE(value = "/articles/:id", name = "articles.delete")
@PATCH(value = "/articles/:id", name = "articles.patch")
Route parameters
@GET(value = "/articles/:id", name = "articles.show")
private Object show(Request req, Response res) {
    String id = req.params(":id");
    // ...
}
Query parameters
@GET(value = "/search", name = "search")
private Object search(Request req, Response res) {
    String query = req.queryParams("q");
    String page = req.queryParams("page");
    // ...
}
Named routes

Use the name parameter to reference routes by name instead of hardcoding paths.

Controller
@GET(value = "/articles/:id", name = "articles.show")
private Object show(Request req, Response res) {
    // ...
}
Pebble template
<a href="">View Article</a>
<form action="" method="post">
    <!-- form fields -->
</form>
Programmatic access
String path = Route.getPath("articles.show");   // "/articles/:id"
boolean exists = Route.hasRoute("articles.show"); // true
Map<String, String> all = Route.getAllRoutes();   // all named routes