feature-sliced/examples

Why we are storing business entities in shared layer?

Closed this issue · 2 comments

Hi there! I'm looking at examples and can't figure out why we are storing business entities in shared layer, If I understood correctly shared layer is a fully abstract layer and doesn't have any business logic, so I think task is a business part and should be kept in entities layer. If I miss, mix, confuse or didn't get correctly something, please correct me. Thanks
https://github.com/feature-sliced/examples/blob/master/todo-app/src/shared/api/typicode/tasks.ts

Hi! It's true that this code is very related to a particular business entity, and it would also be a fine solution to put it there. However, when mapping out the backend endpoints, some of them involve several entities, others don't involve entities at all, so basing the entire API infrastructure on every request belonging to just one entity is inflexible and tends to backfire. That's why here and in other places you may see API methods kept in Shared

Hmm, Ok. Thank you.