外观设计模式是否也只涉及类/模块或实际的API调用? [英] Is the facade design pattern only concerned with classes/modules or actual API calls too?

查看:73
本文介绍了外观设计模式是否也只涉及类/模块或实际的API调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我了解门面设计模式的目的-为客户端提供一个接口,以简化和抽象一个复杂的系统,使他们可以更轻松地执行特定任务.

I think I understand the purpose of the facade design pattern- to provide an interface to a client that simplifies and abstracts a complex system allowing them to more easily perform a specific task.

但我想到的第一件事是微服务样式系统,其中包含许多api,每个api都有特定的用途和功能.

but the first thing I think of is a microservices style system that has many apis with each having a specific purpose and functionality.

如果我创建另一个API(微服务),该API代表客户端对其他两个API进行调用,并将多个API调用抽象为一个调用,则简化了这些API的特定用法,从而简化了API的使用.客户做某事,那也是门面吗?

If I create another API (microservice) that makes calls on behalf of the client to a couple of the other APIs and abstracts the multiple APIs calls to just one call, simplifying the APIs' specific usage away to make it easier for the client to do something, is that a facade too?

或者说门面可能不会调用API,而是会导入其他API使用的模块以获取其功能?

Or maybe a facade would not make APIs call but import the modules used by the other APIs to get their functionality?

我想知道"facade"在这里是正确的模式还是在复杂系统中是否存在用于抽象多个REST API调用的更具体的模式.

I want to know if "facade" is the correct pattern here or if there is a more specific pattern for abstracting multiple REST API calls in a complex system.

推荐答案

是的,

API网关/前端后端

API Gateway / Backends for Frontends

API网关,它是所有客户端的单个入口点.API网关以两种方式之一处理请求.一些请求仅被代理/路由到适当的服务.它通过扇出多个服务来处理其他请求.

API gateway that is the single entry point for all clients. The API gateway handles requests in one of two ways. Some requests are simply proxied/routed to the appropriate service. It handles other requests by fanning out to multiple services.

此模式的一种变体是前端的后端"模式.它为每种客户端定义了一个单独的API网关.

A variation of this pattern is the Backends for frontends pattern. It defines a separate API gateway for each kind of client.

这篇关于外观设计模式是否也只涉及类/模块或实际的API调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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