Api Best practices (conventions and separation of concerns )

I am currently working on a project using .NET APIs and have a few questions regarding controller design. Specifically, I have separate controllers for users and orders, and I am considering the best approach for routing. For example, should I implement nested routes within the Users controller to retrieve a user's orders? Alternatively, should the Orders controller handle update and delete operations, with routes tied to users via nested paths? Additionally, given that the Users controller is primarily focused on user-specific operations (such as updating user information like email and password), I am wondering if it is necessary to mix these operations with order retrieval, or if it would be more appropriate to delegate such responsibilities to a separate controller, for instance, an Account controller. sorry if the questions seems stupid , as i said i am new to this structure . I appreciate any guidance on how to structure these controllers in a coherent and maintainable manner.

Mar 25, 2025 - 22:35
 0
Api Best practices (conventions and separation of concerns )

I am currently working on a project using .NET APIs and have a few questions regarding controller design. Specifically, I have separate controllers for users and orders, and I am considering the best approach for routing. For example, should I implement nested routes within the Users controller to retrieve a user's orders? Alternatively, should the Orders controller handle update and delete operations, with routes tied to users via nested paths?

Additionally, given that the Users controller is primarily focused on user-specific operations (such as updating user information like email and password), I am wondering if it is necessary to mix these operations with order retrieval, or if it would be more appropriate to delegate such responsibilities to a separate controller, for instance, an Account controller.

sorry if the questions seems stupid , as i said i am new to this structure .

I appreciate any guidance on how to structure these controllers in a coherent and maintainable manner.