Overview
GraphQLBlogAPI is a blog backend exposed through a GraphQL API instead of REST. Clients can ask for exactly the data they need in a single request.
The challenge
In a blog, different users may do different things: anyone can read, authors can write, and admins can manage everything. These rules have to be enforced on the server, for every field and operation.
How I solved it
- GraphQL API built with HotChocolate on ASP.NET Core.
- JWT authentication to identify the user.
- Role-based authorization at resolver level, so each query and mutation checks the user's role.
- EF Core for data access.
Tech
- ASP.NET Core, HotChocolate, GraphQL, EF Core