ciao!

sto cercando di capire come organizzare al meglio le rotte in vert.x.
non so se qualcuno di voi lo conosce.

prendendo spunto da altri esempi, ho fatto così:
codice:
Router router = Router.router(vertx);
router.route().handler(BodyHandler.create());
router.get("/utenti").handler(UtentiController::index);
router.post("/utenti/login").handler(UtentiController::login);
e poi in UtentiController:
codice:
public class UtentiController {

  public static void index(RoutingContext routingContext) {
    HttpServerResponse response = routingContext.response();
    response.putHeader("content-type", "text/plain").end("Utenti");
  }

  public static void login(RoutingContext routingContext) {
    HttpServerResponse response = routingContext.response();
    if (!routingContext.body().isEmpty()) {
      JsonObject jsonObject = routingContext.body().asJsonObject();

      String username = jsonObject.getString("username");
      String password = jsonObject.getString("password");

      // ESEGUO QUERY
      if (username.equals("matteo") && password.equals("132456")) {
        JwtHelper jwtHelper = new JwtHelper();

        response
          .putHeader("content-type", "application/json")
          .end(JsonUtils.loginJson("ok", "Login effettuato!", jwtHelper.relaeseToken()));
      } else {
        response
          .setStatusCode(400)
          .putHeader("content-type", "application/json")
          .end(JsonUtils.genericJson("ko", "Credenziali errate!"));
      }

    } else {
      response
        .setStatusCode(400)
        .putHeader("content-type", "application/json")
        .end(JsonUtils.genericJson("ko", "Dati non presenti!"));
    }
  }
}
funziona tutto, ma non sono sicuro che sia il modo migliore.
intanto per tutti quei metodi statici.
e poi perchè volevo raggruppare le varie rotte in gruppi (come si fa in altri framework).

qualcuno ha qualche suggerimento??