Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added initial configuration for GraphQL #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jtorreguitar
Copy link
Contributor

Summary:

GraphQL is a new paradigm to replace REST APIs which makes for a more flexible way to make requests. To learn more about them go to this link.

This PR hopes to take the initial steps to be able to, in future projects, use a GraphQL API. Right now it only "replicates" the functionality to get users by id or to get all users. Of course with the caveat that one can get subsets of the user data. For example, going to https://localhost:5001/ui/playground (if you are running your project in the local port 5001) you can write the following query:

{
  users
  {
    userName
  }
}

This will return a list of all usernames in the application. Right now getting emails will fail because the GraphQL API seems to default to them being non-nullable. Haven't found out how to change this yet.

The tutorial that was used to set this up was: https://medium.com/swlh/the-no-bullsh-t-guide-to-graphql-in-net-core-9df290be7f27
Some corrections had to be made from this tutorial as well: https://medium.com/volosoft/building-graphql-apis-with-asp-net-core-419b32a5305b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant