Introduction: Driving the Web Layer

Get an introduction to what you’ll learn in this chapter.

Building and testing web endpoint

In this chapter, we complete our web application by adding a web endpoint. We’ll learn how to write HTTP integration tests using the built-in Java HTTP client.

We’ll test-drive the web adapter code that runs this endpoint using an open-source HTTP server framework. This web adapter is responsible for converting HTTP requests into commands we can execute in our domain layer. At the end of the chapter, we’ll assemble all the pieces of our application into a microservice. The web adapter and database adapters will be linked to the domain model using dependency injection. We’ll need to run a few manual database commands, install a web client called Postman, and then we can play our game.

Chapter goals

In this chapter, we’ll cover how to configure and test HTTP endpoints. We’ll understand how these endpoints serve as gateways for external clients to interact with our applications, facilitating actions and gameplay experiences. We’ll refine server building, streamline game initialization, and enhance error handling. With a focus on microservice architecture, we’ll optimize interactions for an immersive gaming experience.

Get hands-on with 1200+ tech skills courses.