API Gateway(API 网关)是一种服务器,充当客户端与后端服务之间的中间层,负责接收所有 API 请求,进行路由、组合和协议转换等处理,然后将请求转发给相应的微服务。它是微服务架构中的核心组件。
/ˌeɪ.piː.ˈaɪ ˈɡeɪt.weɪ/
Our team set up an API gateway to manage all incoming requests from the mobile app.
我们的团队搭建了一个 API 网关来管理来自移动应用的所有请求。
By implementing an API gateway, the company was able to enforce rate limiting, authentication, and logging across all its microservices without duplicating code in each service.
通过部署 API 网关,该公司能够在所有微服务中统一实施速率限制、身份验证和日志记录,而无需在每个服务中重复编写代码。
API 是 Application Programming Interface 的缩写,最早在20世纪60年代出现于计算机科学领域,指软件组件之间进行交互的接口。Gateway 源自古英语 gæt(门)和 weg(路),原意为"通道、入口"。两者组合为技术术语 API Gateway,比喻为所有 API 流量的"入口大门",这一概念随着微服务架构在2010年代的兴起而被广泛使用。