Vert.x之旅(一):Hello world

一些翻译,一些理解,自我旅程,记录点点。

依赖库

Maven:

<dependency>
  <groupId>io.vertx</groupId>
  <artifactId>vertx-web</artifactId>
  <version>3.2.1</version>
</dependency>

 Gradle:

dependencies {
  compile 'io.vertx:vertx-web:3.2.1'
}

 

Helloworld

HttpServer server = vertx.createHttpServer();

server.requestHandler(request -> {

  // This handler gets called for each request that arrives on the server
  HttpServerResponse response = request.response();
  response.putHeader("content-type", "text/plain");

  // Write to the response and end it
  response.end("Hello World!");
});

server.listen(8080);

 

猜你喜欢

转载自zzqfsy.iteye.com/blog/2288510