54 Matching Annotations
  1. Jul 2021
    1. Because GraphQL is an opinionated API spec where both the server and client buy into a schema format and querying format. Based on this, they can provide multiple advanced features, such as utilities for caching data, auto-generation of React Hooks based on operations, and optimistic mutations.
  2. Jun 2021
    1. This kind of error handling does express error state (either via HTTP 500 or by the top-level "errors" key), but it doesn’t take advantage of GraphQL’s type system and can only express one error at a time.
    2. It works, but a stronger solution is to treat errors as data.
    3. In mutations, when errors happen, the other fields may return nil. So, if those other fields have null: false, but they return nil, the GraphQL will panic and remove the whole mutation from the response, including the errors!
    1. In general, top-level errors should only be used for exceptional circumstances when a developer should be made aware that the system had some kind of problem. For example, the GraphQL specification says that when a non-null field returns nil, an error should be added to the "errors" key. This kind of error is not recoverable by the client. Instead, something on the server should be fixed to handle this case. When you want to notify a client some kind of recoverable issue, consider making error messages part of the schema, for example, as in mutation errors.
    1. With GraphQL-Ruby, it’s possible to hide parts of your schema from some users. This isn’t exactly part of the GraphQL spec, but it’s roughly within the bounds of the spec.
  3. Mar 2021
  4. Feb 2021
  5. Oct 2020
  6. Sep 2020
    1. urql/packages/svelte-urql/ Go to file Add file Go to file Create new file Upload files urql/packages/svelte-urql/
    1. you may specify only the form state that you care about for rendering your gorgeous UI. You can think of it a little like GraphQL's feature of only fetching the data your component needs to render, and nothing else.
    1. Intro to using GraphQL with Craft CMS, using a practical example. Rather technical (many things I don't understand). But it gives a good idea of what is happening.

  7. Jun 2020
    1. const httpLink = new HttpLink({ uri: 'https://instagram-clone-3.herokuapp.com/v1/graphql' }); const authLink = setContext((_, { headers }) => { const token = accessToken; if (token) { return { headers: { ...headers, authorization: `Bearer ${token}` } }; } else { return { headers: { ...headers } }; } }); const client = new ApolloClient({ link: authLink.concat(httpLink), cache: new InMemoryCache() });

      concat two link

  8. May 2020
    1. Although there were some patenting and licensing concerns with GraphQL, these have been resolved to our satisfaction by the relicensing of the reference implementations under MIT, and the use of the OWF license for the GraphQL specification.
    1. Apollo client, help with handling errors, but not as easily as in a REST API

      Error handling conventions

    2. not recommended because it adds more complexity because of things such as: Types Queries Mutators Resolvers High-order components

      Using GraphQL in a simple application (for example, one that uses a few fields in the same way, every time)

  9. Apr 2020
    1. GraphQL gels especially well with modern JavaScript driven front ends, with excellent tools like Apollo and Apollo-Server that help optimise these calls by batching requests.

      GraphQL + Apollo or Apollo-Server

    2. BFF is an API that serves one, and specifically only one application

      BFF (backend for frontend):

      • translates an internal domain into the terminal language of the app it serves
      • takes care of authentication, rate limiting, and other stuff you don't want to do more than once
      • reduces needless roundtrips to the server
      • translates data to be more suitable for its target app
      • is pretty front-end-dev friendly. Queries and schema strongly resemble JSON & it keeps your stack "JS all the way down" without being beholden to some distant backend team
    3. GraphQL really is just a smart and effective way to schema your APIs, and provide a BFF – that’s backend for frontend
    4. What sets GraphQL apart a little from previous approaches (notably Microsofts’ OData) is the idea that Types and Queries are implemented with Resolver code on the server side, rather than just mapping directly to some SQL storage.

      What makes GraphQL favorable over other implementations.

      In result:

      • GraphQL can be a single API over a bunch of disparate APIs in your domain
      • it solves the "over fetching" problem that's quite common in REST APIs (by allowing the client to specify a subset of data to return)
      • acts as an anti-corruption layer of sorts, preventing unbounded access to underlying storage
      • GraphQL is designed to be the single point of connection that your web or mobile app talks to (it highly optimises performance)
    5. GraphQL is confusingly, a Query Language, a standard for HTTP APIs and a Schema tool all at once.

      GraphQL

  10. Mar 2020
    1. The combination of WordPress, React, Gatsby and GraphQL is just that - fun

      Intriguing combination of technologies.

      Keep an eye on the post author, who is going to discuss the technologies in the next writings

  11. Feb 2020
  12. Jan 2020
  13. Dec 2019
    1. The foundation of GraphQL is its type system. There are basic types like String and Integer and there are complex types that have named attributes.

      Type system is the foundation of GraphQL

  14. Nov 2019
    1. REST and GraphQL are wonderful tools to create an API that is meant to be consumed by third parties. Facebook's API, for example, is consumed by ~200k third parties. It is no surprise that Facebook is using (and invented) GraphQL; a GraphQL API enables third parties to extensively access Facebook's social graph enabling them to build all kinds of applications. For an API with that many consumers, GraphQL is the fitting tool. But, to create an internal API (an API developed and consumed by code written by the same organization), RPC offers a simpler and more powerful alternative. Large companies, such as Netflix, Google and Facebook, are starting to replace REST/GraphQL with RPC for their internal APIs. Most notably with gRPC which is getting popular in the industry.
    2. RPC is increasingly used to create backend APIs as most are internal: most of the time, a backend API is consumed only by frontends developed within the same organization. In general, REST and GraphQL are the right tools if you want to create an API consumed by code written by third parties and RPC is the right tool if you want to create an API consumed by code written by yourself / your organization.
  15. Jun 2019
  16. Nov 2018
    1. GraphQL is being used in production by a variety of high scale companies such as Airbnb, Atlassian, Audi, CNBC, GitHub, Major League Soccer, Netflix, Shopify, The New York Times, Twitter, Pinterest and Yelp. GraphQL also powers hundreds of billions of API calls a day at Facebook.

      Usage of graphql by companies

  17. Oct 2018