注册新用户的最佳方式是什么 - 获取 vs post

what is the best way to register a new user - get vs post

我正在努力学习注册新用户的最佳做法。

我只能想到两个选项(但也许还有更多!),我希望知道哪个更适合速度和整体练习:

第一种方法:

a. once the user submits a new user&pass, i make a GET request on a REST entrypoint
b. if the user exists then let him know, if not then make a POST request

第二种方法:

a. once the user submits a new user&pass, i make a POST request, within which a GET request is made.
b. if the user exists then let him know, if not then continue with the POST

此外,这些是否应该在一个入口点内完成 - 返回客户端,然后让 js 进行另一次调用

谢谢

最好只有一个 POST 请求,如果用户已经存在,return 状态为 409(冲突),如果用户创建成功,状态为 201(资源已创建)。