如何在 android 中使用 GraphQl? [英] How can I use from GraphQl in android?

查看:56
本文介绍了如何在 android 中使用 GraphQl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个简单的例子来在 android 中使用 GraphQl.

I need to a simple example for use GraphQl in android .

如何从 GraphQl 在 android 中使用(教程).

How can I use from GraphQl in android (tutorial).

推荐答案

为了使用 GraphQL(一般来说),你需要做两件事:

In order to use GraphQL (in general), you need two things:

有几种方法可以解决这个问题.当然,你可以简单地去自己实现一个 使用您喜欢的任何服务器端语言.其他(更快)方法是利用现有工具并使用诸如 graphql-up<之类的服务生成 GraphQL API/a> 或 create-graphql-server 甚至像 Graphcool 这样的服务(免责声明:我为他们工作).

There are a few ways how you could go about this. Of course, you could simply go and implement one yourself in any server-side language you like. Other (faster) approaches are to take advantage of existing tooling and generate a GraphQL API using services like graphql-up or create-graphql-server or even services like Graphcool (disclaimer: I work for them).

虽然这不是绝对必要的,你也可以简单地通过普通的 HTTP 与 GraphQL 服务器交互(在 POST 请求的正文中发送你的查询和更改),但使用现有的重复工作的工具肯定是有益的比如缓存或 UI 集成.目前最流行的 GraphQL 客户端之一是 Apollo,他们非常积极地致力于 Android 版本.但是,这还没有正式发布.因此,您要么必须使用他们现有的开发版本,而现在选择使用纯 HTTP 的前一种方法.

Though this one isn't strictly necessary and you could also simply interact with the GraphQL server through plain HTTP (sending your queries and mutations in the body of POST requests), it is certainly beneficial to use existing tools that take repetitive work like caching or UI integrations off your shoulders. One of the most popular GraphQL clients right now is Apollo, and they're very actively working on a version for Android as well. However, this hasn't been officially released yet. So, you either have to use their existing development version of chose the former approach using plain HTTP for now.

这篇关于如何在 android 中使用 GraphQl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆