scala-webapp-template icon indicating copy to clipboard operation
scala-webapp-template copied to clipboard

Refactor Api layer

Open AlexITC opened this issue 2 years ago • 0 comments

The current approach for invoking the backend API is somewhat annoying:

  1. We have an ApiClient, while that's a trait, we just have a specific implementation, making it a class can simplify this.
  2. Still, ApiClient implements just every method, which has lots of repetitive code and the class file gets unnecessarily long (seems one of those rare cases where the cake-pattern could be helpful0.

There is also an alternative way, what if each Api class knows how to invoke backend? this way, we could keep Api files to be self-contained.

I think that the alternative approach is worth exploring.

AlexITC avatar Jan 27 '23 04:01 AlexITC