schedule 03:15 PM - 04:00 PM place Esquire

When we were building our cloud orchestration platform, we were looking into writing our API Gateway server in scala and strictly functional because we knew the API is going to be doing lot of heavy lifting and it will be constantly extended. We stumbled upon scalaz, a brilliant library for scala to write functional programs. It was indeed a pleasure for the whole team to write the API since then.

I will be talking more about how we designed and built the REST API that powers megam cloud platform(megam.io). Developers with scala experience will be able to take away on getting started with scalaz library.

 
8 favorite thumb_down thumb_up 0 comments visibility_off  Remove from Watchlist visibility  Add to Watchlist
 

Outline/structure of the Session

  1. Introduction to scala/playframework  & design of our RESTful API

We will start with a quick introduction to scala-lang.org, and the high velocity webframework playframework.com. Then we go in to start the seed of our topic by providing insights on  design of how our RESTful API is architected.

  1. What is scalaz ? What do we use from scalaz ?

One of the functional frameworks for Haskell refugees in Scala is scalaz (https://github.com/scalaz/scalaz). Hence we start with an introduction on what it is and then talk about the basic Functor, Applicative, Monad (map, flatMap). After setting the background we go in deeper on where we have leveraged scalaz and how. We have leveraged in the following areas

  1. Error handling using Validation
  2. Chaining computations using ValidationNels
  3. EitherT on aggregate error handing of a iterated computation
  4. IO wrapper
  5. State monad on implementing inmemory persistance.
  1. A walkthrough of an API call

We will talk about one API and its journey in the RESTful API server (https://github.com/megamsys/megam_gateway.git). We start with the HMAC API authentication approach as designed in a functional way and how it gets handled automatically during every API call using scala implicits.

  1. Transport layer  for JSON

 The data layer as responsible for storing data and its design philosophy will be discussed. This is essentially the business logic. The JSON that comes in gets parsed and stored in the NOSQL database Riak(docs.basho.com) after a type validated schema.

  1. Response Layer

Now that we have completed our data storage, its time to return stuff back to the client.  We use a function appoach to collate errors and send back to the client.

We will show a demo of its workings..

code: https://github.com/megamsys

web: https://www.megam.io

Learning Outcome

At the end of the talk, listeners will be able to have a good understanding how to program in scala, using scalaz to write an elastic RESTful API.

Target Audience

People who'd want to learn scala and write functional code with scalaz library

schedule Submitted 2 years ago

Comments Subscribe to Comments

comment Comment on this Proposal