O'Reilly logo

Instant Vert.x by Simone Scarduzio

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Quick start – creating your first web server

In this first part we'll see how to realize a web server capable of serving static pages from the file system.

Step 1 – fresh start

  1. In a clear folder called, for example, 1_BasicWebServer, let's open our editor of choice and create here a file called webserver.js.
  2. Also, make sure that you have a terminal window open and you moved into the newly created project directory.

Step 2 – creating the HTTP server

  1. Let's go ahead and fill in some code:
    var vertx = require(vertx); /* 1 */
    var httpServer = vertx.createHttpServer(); /* 2 */
    httpServer.listen(8080, localhost); /* 3 */
  2. First of all, we obtain the vertx object. This is a bridge object that wraps all the functionality offered by the framework.
  3. We ask the vertx ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required