8 The web stack

 

This chapter covers

  • The construction of an edge service and a public API
  • The Vert.x web client
  • JSON web tokens (JWT) and cross-origin resource sharing (CORS)
  • Serving and integrating a Vue.js reactive application with Vert.x
  • Testing an HTTP API with REST Assured

Reactive applications often use HTTP because it is such a versatile protocol, and Vert.x offers comprehensive support for web technologies. The Vert.x web stack provides many tools for building web application backends. These include advanced routing, authentication, an HTTP client, and more. This chapter will guide you through exposing an HTTP API with JSON web tokens (JWT) for access control, making HTTP requests to other services, and building a reactive single-page application that connects to the HTTP API.

Note

This book does not cover the following noteworthy elements from the Vert.x web stack that are not needed to build the application in this part of the book: routing with regular expressions, cookies, server-side sessions, server-side template rendering, and cross-site request forgery protection. You can get more details about those topics in the official documentation at https://vertx.io/.

8.1 Exposing a public API

8.1.1 Routing HTTP requests

8.1.2 Making HTTP requests

8.2 Access control with JWT tokens

8.2.1 Using JWT tokens

8.2.2 What is in a JWT token?

8.2.3 Handling JWT tokens with Vert.x

8.2.4 Issuing JWT tokens with Vert.x

8.3 Cross-origin resource sharing (CORS)

8.3.1 What is the problem?

8.3.2 Supporting CORS with Vert.x

8.4 A modern web frontend

8.4.1 Vue.js

8.4.2 Vue.js application structure and build integration