stevie
stevie
CC#
Created by stevie on 2/2/2024 in #help
How to organize API routes?
There is a .NET 6 WebApi with 2 controllers: PlatformsController and OrdersController. Now, in order to get orders, passing platformId is mandatory. /orders/{platformId} But ideally the api route would look like: /platforms/{platformId}/orders/{orderId}. But since orders must belong to platforms I'm forced to use 1 controller - PlatformsController. But in this case everything will have to be inside PlatformsController and swagger will show only one controller and won't be separated by orders for example. How to get around this?
3 replies
CC#
Created by stevie on 8/4/2023 in #help
❔ How to organize folder structure in .NET with HotChocolate 13
Can someone please guide me on organizing folder structure in HotChocolate 13 GraphQL here. We have entities and DbContext. Can I use them instead of creating Types? Also, I've seen many cases where people create folders for each command e.g. /Queries/AddProduct/AddProduct.cs, AddProductInput.cs, AddProductPayload.cs And also seen people creating /Queries/ProductQueries.cs and store all commands init. And store AddProductInput.cs and AddProductPayload.cs in /Models folder. How do I follow Relay pattern and organize with scalability in mind?
4 replies