loading...

ASP.NET Core (Rest Web API or GraphQL)

twitter logo github logo ・1 min read

I'll be working on a new pet project, the project consists of client applications(Web Application SPA, and a Xamarin.Forms mobile Application), the backend will be ASP.NET Core, now I'm curious if I should use Web API(Rest) or should I go use GraphQL?

Another question also, is GraphQL the new way to go when implementing APIs which is going to be consumed by different client apps(mobile and web)?

twitter logo DISCUSS (4)
markdown guide
 

I suggest GraphQL even if it is challenging at first, it is really nice for code-first usage. Maybe take a look at hotchocolate.io/ it looks easier than graphql-dotnet.github.io/ , also you can find GraphQL voyager and playground on NuGet, if you need those tools. But if you need any authorization/authentication you will need to implement it manually for GraphQL. Maybe take look on OData, it gives you the power of selectable response (even with including/joins and aggregations, filtering...) payload while maintaining everything as REST.

 

Thanks! I’ll definitely check those links/resources you provided. I have tried OData in the past for some simple applicatiosn(POC type of app), I haven’t really tried GraphQL, I noticed APIs written in it are becoming more and more prevalent. Interesting that you mentioned OData, so does it mean we can use OData with Rest we’ll get the benefits of GraphQL without using it? 😅

 

Definitely some of them, even more, if you don't like to write aggregations filtering or sorting because with OData you can do it in a query. But evaluate the decision, I don't know how is OData support for .net Core 3.0,3.1 at this point, a couple of months ago it wasn't, and in December it was in beta. Everything has pros and cons. Choose what can help you the most. Anyway, I like to use Both. Good luck.

I'll definitely have a look at both and see for myself the pros and cons, Thanks! 🙌

Classic DEV Post from Sep 27 '19

What was your win this week?

Got to all your meetings on time? Started a new project? Fixed a tricky bug?

Randel Ramirez profile image
Basketball | Programming | Surfing