| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This sample shows how to deploy a Vert.x application to Google App Engine stadndard.
See Prerequisites.
gcloud app deployNavigate to https://<your-project-id>.appspot.com.
The application is written to use Eclipse Vert.x to demonstrate the use of Vert.x Web as web server and Vert.x Web client.
Vert.x is a fully non-blocking toolkit and some parts of the application use callbacks.
The main class creates the Vert.x instance deploys the Server class:
Vertx vertx = Vertx.vertx(); vertx.deployVerticle(new Server());
When the application starts
webClient = WebClient.create(vertx);
Router router = Router.router(vertx);
router.route().handler(this::handleDefault);
vertx.createHttpServer()
.requestHandler(router)
.listen(8080, ar -> startFuture.handle(ar.mapEmpty()));
HTTP requests are served by the handleDefault method. This method uses the WebClient to query the Google metadata API for the project ID and returns an Hello World string that contains the project ID name.
| Back | FazBrowse Home | New Git URL |