简体   繁体   English

node.js注册:发布数据还是套接字?

[英]node.js registration: post data or sockets?

i have a small question, what is the better solution for registration to node.js: Send form in POST method, like a: 我有一个小问题,什么是向node.js注册的更好解决方案:以POST方法发送表单,例如:

req.on('data', function(data) {
    console.log(data);
});

or send in sockets? 或发送套接字?

socket.emit("newUser", username, email, password)

Sockets are the better performance method, right? 套接字是性能更好的方法,对吗? But POST method is more natural(?)... standard HTTP etc.. So... what do you think about this question, what is better to standard registration system? 但是POST方法更自然(?)...标准HTTP等。那么...您如何看待这个问题,什么对标准注册系统更好?

I prefer to use normal post method and http module or express module to handle your requests 我更喜欢使用普通的post方法和http模块或express模块​​来处理您的请求

This will help you in controlling user sessions and help you to Choose your security methods.So shortly it will give you a better control on your application. 这将有助于您控制用户会话并帮助您选择安全性方法。因此,不久它将为您提供对应用程序的更好控制。

I like POST personally cause I can quickly use curl w/it.. 我个人喜欢POST,因为我可以快速使用w.it。

curl --data "a=1&b=2" myhost.net/api

and posts are so easily handled within express or httpserver.. 并且帖子可以在Express或httpserver中轻松处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM