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

推荐订阅源

I
Intezer
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
N
News | PayPal Newsroom
T
Tenable Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
P
Privacy International News Feed
IT之家
IT之家
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
博客园_首页
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
NISL@THU
NISL@THU
I
InfoQ
D
DataBreaches.Net
有赞技术团队
有赞技术团队
K
Kaspersky official blog
Security Latest
Security Latest
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
S
Security @ Cisco Blogs
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic

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 的集成。