[英]Understanding user creation between Express Gateway & Microservices ( or Monolithic API )
I'm in the process of learning and experimenting with Express Gateway and some simple services ( or even just a small monolithic api that sits behind the gateway )我正在学习和试验 Express Gateway 和一些简单的服务(甚至只是网关后面的一个小型单片 api)
I have gone through Express Gateway 'Getting Started' examples and have read through documentation.我浏览了 Express Gateway 的“入门”示例并通读了文档。
Right now I'm trying to grasp how a user of the system, client/customer, will be created.... The confusion lies in the area where the 'Getting Started' tutorials had me create a user WITHIN Express Gateway.现在,我正试图了解如何创建系统用户(客户/客户)......混乱在于“入门”教程让我在 Express Gateway 内创建用户的区域。
But coming from a monolithic RESTful API viewpoint... the system may have its own DB schema for what a User is.但是来自一个单一的 RESTful API 观点......系统可能有自己的用户数据库模式。 Client app calls an API endpoint for user creation, goes through its own process, makes the record, returns to the client a successful creation ( or not ).客户端应用程序调用 API 端点来创建用户,通过自己的过程,制作记录,向客户端返回成功创建(或不成功)。 Then getting the user authorized ( JWT / OAuth / etc.. )然后让用户授权( JWT / OAuth / etc..)
So using Express Gateway, do we need to create a user, then pass that ID down to a UserService to save in its own dB, linking this newly created id with the express gateway id ?那么使用 Express Gateway,我们是否需要创建一个用户,然后将该 ID 传递给 UserService 以保存在它自己的 dB 中,将这个新创建的id与 express gateway id链接起来?
That is correct;那是对的; usually what you want to do when you are creating a new user is to make a call both your database/service and to Express Gateway as well with some of the details so they stay in sync.通常,当您创建新用户时,您想要做的是调用您的数据库/服务和 Express Gateway 以及一些详细信息,以便它们保持同步。
If you do not really want to do that it's advised to use a thirty party service such as Auth0 to keep the identity users decoupled from the user details.如果您真的不想这样做,建议使用 Auth0 等三十方服务来保持身份用户与用户详细信息的分离。
Does that explain/clarify?这是否解释/澄清?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.