Let's take it one step further!
Your HTTP endpoints are data, as well!
We’re used to defining HTTP API endpoints using annotations (@GET, @Param, …), that is, using metadata. Why not take it one step further, and use a “normal” data structure to describe endpoints? A data structure which we could manipulate and abstract over as any other value in our system.
How would the code look like? What kind of operations can we perform, once our endpoints are represented as data? What do we gain? And do we loose anything? Is the resulting code readable?
In this live-coding talk we’ll implement a simple HTTP API from scratch, using Scala and the tapir library, which takes the approach described above. Basic Scala knowledge (or even no Scala knowledge at all) will be sufficient to follow.
Come and see how functional programming improves on the status quo and provides an elegant and flexible solution to an everyday problem!
This talk was given by Adam Warski at Scala Love Conference 2020.