![]() ![]() This is by no means an issue exclusive to GraphQL apps, but it’s true that they generally require you to write a lot of similar boilerplate code. For example, it’s not advisable for data that changes frequently, or for data that depends on the currently logged-in user. For example, you might want to cache the list of recent posts featured on your frequently-accessed homepage, but not the full list of posts available on your archives page.Ī final note: caching might not always be possible. The beauty of this approach is that you can easily control which queries are cached and which aren’t, even for the same resolver. So this JavaScript field: title: )(PostsList) I was using SimpleSchema to describe my schemas as JavaScript objects, and I started simply by converting JavaScript’s String type into a GraphQL String, Number into Int or Float, and so on. I also remember hearing Laney Zamore & Adam Kramer from the GraphQL team describe how they directly generated their GraphQL schema from their PHP type definitions.įor Vulcan, I independently stumbled on a very similar solution. Monetize your audience and traffic with the top ad network. Categories Featured About Register Login Submit a product. For example, PostGraphile generates a GraphQL schema from your PostgreSQL database, and Prisma will also help you generate types for your queries and mutations. A list based on our community, research Altair GraphQL, GraphQL Playground, AdMaven, graphql-yoga, Hasura, GraphQL Voyager, and Explore GraphQL. Solution: GraphQL Schema GenerationĪ number of solutions to this problem have emerged in the GraphQL ecosystem. Not only is it frustrating to have to write more or less the same thing twice, but you now have two independent sources of truths that you need to constantly keep in sync. Namely, you need one schema for your database, and another one for your GraphQL endpoint. One of the first things you realize when coding a GraphQL back-end from scratch is that it involves a lot of similar-but-not-quite-identical code, especially when it comes to schemas. But hopefully, you’ll be able to apply the same strategies to your own codebase whether you use Vulcan or not. Good news is, none of them are incurable!įor each issue, I’ll describe the problem, and then explain how I’m addressing it inside Vulcan, a React/GraphQL open-source framework I’ve been working on over the past year (you should check it out!). I’m willing to bet your app suffers from at least one of them. And if you’re not careful, these issues might not only lead to a bloated codebase, but even to a dramatically slowed-down app. Yet I’d be lying if I told you that GraphQL doesn’t come with its own set of issues. Clearly see individual GraphQL requests including support for query batching. GraphQL is all the rage these days, and for good reason: it’s an elegant approach that solves many of the problems associated with traditional REST APIs. GraphQL Network Inspector A platform agnostic network inspector specifically built for GraphQL. By Sacha Greif Five Common Problems in GraphQL Apps (And How to Fix Them) Learn to unlock the power of GraphQL without suffering its drawbacks ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |