简体   繁体   English

客户端/服务器通信如何与meteor / nodejs一起使用

[英]how client/server communication works with meteor/nodejs

I'm learning about Meteor. 我正在学习流星。 Right now I'm trying to figure out how the client/server communication works, I have a file under [root]/server with all the information to connect to DB (user, password, host, port) also I have the following line of code to test this "communication" 现在我正在试图弄清楚客户端/服务器通信是如何工作的,我在[root] / server下有一个文件,连接到DB的所有信息(用户,密码,主机,端口)我也有以下行测试这个“通信”的代码

 var getUsers = function(name) {
           return "Hi. I'm " + name;
      };

and in my root folder I have: 在我的根文件夹中我有:

console.log(getUsers("Juan!"));

however I'm getting "Uncaught ReferenceError: getUsers is not defined " error. 但是我得到“Uncaught ReferenceError:getUsers is not defined”错误。 so the question is, What I'm doing wrong???????? 所以问题是,我做错了什么????????

thanks in advance for any help or hint 提前感谢任何帮助或暗示

Discover Meteor book have a great chapter about it: 发现流星书有一个很好的章节:

I recommend you read the whole book, is very good. 我建议你看完整本书,非常好。

Update: 更新:

This point of Meteor refence also explains very well the communication between methods, like server <> client communication. Meteor refence的这一点也很好地解释了方法之间的通信,例如服务器<>客户端通信。 http://docs.meteor.com/#meteor_call http://docs.meteor.com/#meteor_call

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

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