Bvid28zhvqvmwvaftk27
SkillsCast

Finch: Your REST API as a Monad

10th December 2015 in London at Business Design Centre

There are 56 other SkillsCasts available from Scala eXchange 2015

Please log in to watch this conference skillscast.

547696705 640

Finch is a purely-functional library for building composable REST APIs on top of Finagle.

It's well known and widely adopted in Finagle that "Your Server as a Function" uses Request => Response. In a REST API setting this function may be viewed as Request =1=> (A =2=> B) =3=> Response, where transformation 1 is request decoding (deserialization), transformation 2 -is business logic and transformation, and transformation 3 is- response encoding (serialization).

The only interesting part here is transformation 2 (i.e., A => B). Since it's usually a challenge to deal with pure functions in real-world problems, we wrap this into a monad M[_], so that a transformation (i.e, map, flatMap) M[A] => M[B] encodes the business logic of a REST API server.

This and other ideas are implemented in Finch, a purely-functional library for building composable REST APIs on top of Finagle.

Read about Your Server as a Function here.

YOU MAY ALSO LIKE:

Finch: Your REST API as a Monad

Vladimir Kostyukov

Vladimir started his software engineering career working on compilers and virtual machines at Intel. After several years of writing C++, he decided to switch camps and joined the Finagle team at Twitter.