问题描述
在 jhipster 堆栈中拥有多个网关应用程序是否是不好的做法以及可能产生的后果.
Is it bad practice and what are possible consequences of having more than one gateway applications in the jhipster stack.
我正在开发一个应用程序,它具有非常不同的用户部分和管理部分.这个想法是有 2 个网关,一个用于用户 Web 应用程序,一个用于管理 Web 应用程序.他们都有自己的微服务作为后端.此外,还有包含通用功能的第三个共享微服务.
I am working on an application that has user part and admin part which are very different. The idea is to have 2 gateways, one for user web app and one for admin web app. Both of them would have their own microservice as backend. Plus there is third shared microservice that contains common functionality.
所以它看起来像这样:
user web app (gateway) admin web app (gateway)
\ /
\ /
user microservice admin microservice
\ /
\ /
shared microservice
我用简单的例子尝试过它,它似乎在开发环境中工作.除了它不优雅之外,还有其他原因导致这种架构不正确吗?
I have tried it with simple examples and it seems to work in dev environment. Besides that it is not elegant, are there other reasons why this architecture is not right.
推荐答案
我认为有多个网关没有问题
I see no problem in having multiple gateways
JHipster 文档中明确说明您可以拥有多个网关(请参阅 http://www.jhipster.tech/microservices-architecture/) 以适应控制您向哪个客户端公开哪些服务的需要.此外,您可以配置 zuul 代理以限制每个网关上允许的路由.
It is explicitly stated in the JHipster documentation that you can have several gateways (see http://www.jhipster.tech/microservices-architecture/) to accommodate the need to control which services you expose to which client. Moreover you can configure the zuul proxy to restrict the allowed routes on each gateways.
这篇关于jhipster 中不止一个网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!