learn-node icon indicating copy to clipboard operation
learn-node copied to clipboard

graphql

Open luoxue-victor opened this issue 6 years ago • 2 comments

luoxue-victor avatar Mar 21 '20 05:03 luoxue-victor

优化 tips

  1. 逐步迁移现有接口 以下游微服务或数据库为单位进行逐步迁移

  2. 使用新字段或者字段参数来升级接口

  3. 使用DataLoader解决 N+1 DataLoader 收集单数据请求,交给批处理函数统一处理,减少数据库调用次数

  4. 自动生成 Schema

使用自动生成脚本从数据库/下游服务(主要是rpc)自动生成 Schema

  1. 自定义标量类型

处理非 JSON 类型接口和无法用Query描述的数据结构时,可以自定义标量类型,并实现串花函数。

  1. 不适合使用的一些场景
  • 前端需求简单,接口复用率低
  • 功能迭代不活跃

luoxue-victor avatar Apr 02 '20 02:04 luoxue-victor

权限管理,graphql 不做任何敏感数据的查询

luoxue-victor avatar Apr 02 '20 10:04 luoxue-victor