Starting a new game
In this section, we will test-drive a web adapter that will provide our domain model with an HTTP API. External web clients will be able to send HTTP requests to this endpoint to trigger actions in our domain model so that we can play the game. The API will return appropriate HTTP responses, indicating the score for the submitted guess and reporting when the game is over.
The following open source libraries will be used to help us write the code:
Molecule
: This is a lightweight HTTP frameworkUndertow
: This is a lightweight HTTP web server that powers the Molecule frameworkGSON
: This is a Google library that converts between Java objects and JSON structured data
To start building, we first add the required libraries as dependencies to the build.gradle
file. Then we can begin writing an integration test for our HTTP endpoint and test-drive the implementation.
Adding required libraries to the project
We need to add the three libraries...