importio.vertx.core.AbstractVerticle;importio.vertx.core.Promise;importio.vertx.ext.healthchecks.HealthCheckHandler;importio.vertx.ext.healthchecks.HealthChecks;importio.vertx.ext.web.Router;publicclassMainVerticleextendsAbstractVerticle{@Overridepublicvoidstart(Promise<Void>startPromise)throwsException{HealthCheckHandlerhealthCheckHandler=HealthCheckHandler.createWithHealthChecks(HealthChecks.create(vertx));HealthCheckManager.configureHealthChecks(healthCheckHandler);Routerrouter=Router.router(vertx);router.get("/ping").handler(healthCheckHandler);router.get("/*").handler(routingContext->{routingContext.response().putHeader("content-type","text/plain; charset=utf-8").end("Hello smolthing \uD83D\uDCA9.");});vertx.createHttpServer().requestHandler(router).listen(8888,http->{if(http.succeeded()){startPromise.complete();System.out.println("HTTP server is running on port 8888");}else{startPromise.fail(http.cause());}});}}
Top comments (0)