Need help improving my API structure
I am just finishing up my second asp.net core project where I built an API for an Angular front end and I want to avoid some of the issues I had on this project so could really use some advice.
Early on I spotted that the repetitive part was building the queries and filters around endpoints that return a collection of objects. I googled for a solution but didn't really know what I was looking for so I ended up writing my own generic filtering and sorting methods that use System.Linq.Dynamic.Core but it is not an ideal solution and I have to explain it to front end guy because it is my own creation and the lack of a formal approach to the endpoint structure has led to comments about needing to be more efficient with my approach.
Since then I have come across OData and GraphQL but I am not really sure if they are appropriate.
The main thing I want to do is
- simplify the task of filtering and sorting collections returned from endpoint
- make data uniform so front end guy can re-use more code
- give me a set structure to work to so I am not rolling my own solutions that someone else might not quickly understand
I wont have much time to study when I wrap this project and move onto the next so I would like to get some advice on what I should be looking at. Should I be learning Odata or GraphQL? Is there any other (maybe simpler) solution? Your advice is greatly appreciated.
Many thanks
0 comments:
Post a Comment