• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: July 17th, 2023

help-circle

  • How I think about repositories:
    These are simple wrappers around database calls that have few or no dependencies. If I’m adding dependencies here, then they’ll either be a cache or a logger.

    Make repositories as simple as possible, because texting them sucks. You make a repository because it makes unit testing your service easier.

    How I think about services:
    Services are just groups of related methods. In a simple CRUD API, I would typically do a service per controller and include all business logic at the service level.

    How I think about controllers:
    These should be treated like repositories and only contain logic for determining which response code to send.