惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 热门话题
Stack Overflow Blog
Stack Overflow Blog
B
Blog
WordPress大学
WordPress大学
Project Zero
Project Zero
P
Palo Alto Networks Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
T
Tailwind CSS Blog
Forbes - Security
Forbes - Security
F
Full Disclosure
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
O
OpenAI News
Spread Privacy
Spread Privacy
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
IT之家
IT之家
U
Unit 42
腾讯CDC
S
Security Affairs
C
Cisco Blogs
Schneier on Security
Schneier on Security
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss

GraphQL

Graphql 太难用了,难监控性能,难客户端缓存 - V2EX 请教一个 graphql subscriptions 问题 - V2EX 做前后端分离接口开发时,用 graphql 的多吗? - V2EX 关于 N+1 问题解决方案的疑问 - V2EX 有用过 GraphQL 的吗?可以进来说说相比 restful 的优劣吗? - V2EX Hello GraphQL - V2EX prisma 和 普通 orm 的区别是什么? - V2EX
国内用 GraphQL 的好像不多? - V2EX
BeijingBaby · 2024-09-22 · via GraphQL

GraphQL 很好用,对比 RESTful API 简直完胜。但是很多人并不理解 GraphQL ,甚至把 GraphQL 和 SQL 混为一谈。

GraphQL 在团队开发中解决了 3 个主要问题:
1. 服务端到客户端的强类型:GraphQL 本身是一门语言,而且是强类型语言。使用 GraphQL 客户端能够通过服务端提供的 schema 生成全面的 API 类型,极大减轻了前端的负担;
2. 文档与沟通:每个 GraphQL 服务都会有一个 schema 文件,这个文件就描述了该服务内的所有接口,要了解该服务可以直接看 schema 而不是代码;
3. 接口聚合:GraphQL 允许客户端定义要获取的字段,前端想拿什么接拿什么,避免了前后端扯皮( https://www.v2ex.com/t/1036619 )。大型项目里常常需要 BFF 中间层也是为了接口聚合,很多 BFF 层甚至都是拿 GraphQL 搞的。

看楼主的发言,我估计后端是直接用 PostGraphile, hasura 这样的框架直接把数据库表以 GraphQL 的形式暴露给前端。不得不说这是效率极高的做法,但是很难控制权限访问,只适合快速开发阶段使用。常规开发时我还是建议使用 nest.js 这样的框架老老实实做功能。

顺带安利我们团队自研的 GraphQL 框架 GQLoom:
https://github.com/modevol-com/gqloom
GQLoom 是实现优先( Implementation-First )的 GraphQL 框架,适用于 JavaScript/TypeScript 。GQLoom 最大的亮点是允许使用 Zod 、Valibot 这样的 Schema 库构建 GraphQL ,代码简洁且有完善的类型安全,马上会跟进对 Prisma 、Drizzle ORM 的集成。