...

/

Wrapping the Server in an API

Wrapping the Server in an API

Let’s learn about the API layer and start validating our quizzes.

The API layer has the following tasks to fulfill:

  • Insulate the server layer from inconsistent data and stitch together independent concepts from the individual GenServer implementations.

  • Hide internal implementations from the user, such as the Quiz struct we make available from our QuizManager server.

Any implementation details from server layers or the functional cores will be off-limits.

Similarities with OOP

Though our internal details may be radically different, the API-wrapped server will share many characteristics of an OOP object:

  • It will hide implementation details, including state, behind an API of functions.

  • It will allow complex interactions between components with message passing and will allow convenient state ...