In this chapter, we added a search ApiController
class. Because the tweets returned by the Twitter API were not adapted to our usage, we introduced a LightTweet
class to transform them into a friendlier format.
We also developed a user API. The User
class is the model. The users are stored and retrieved via the UserRepository
class, and the UserApiController
class exposes HTTP endpoints to perform CRUD operations on the users. We also added a generic exception and a mapper to associate the exception to an HTTP status.
In the configuration, we added a bean that documents our API, thanks to Swagger, and we customized the serialization of our JSR-310 dates. Our code base should look like the following: