node.js 与meteor.js 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11461411/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 16:01:50  来源:igfitidea点击:

node.js vs. meteor.js what's the difference?

node.jsmeteor

提问by ZacAttack

So I've been hearing/reading alot about meteor.js. The tutorials make it seem very sporty as a framework, but I'm still a bit of a novice when it comes to web programming.

所以我一直在听/读很多关于meteor.js 的信息。教程使它作为一个框架看起来非常运动,但在 Web 编程方面,我仍然有点新手。

I've been trying over the last month and half to really learn node.js and figure out how it all comes together. I like the how fast and easy it is to get up and running, and the community that comes along with it (which is exemplified by the mind blowing number of frameworks you can get for Node).

在过去的一个半月里,我一直在尝试真正学习 node.js 并弄清楚它们是如何结合在一起的。我喜欢它的启动和运行是多么快速和容易,以及随之而来的社区(例如,您可以为 Node 获得的令人兴奋的框架数量)。

But what about meteor? What are the real advantages of it, and what's the difference? Has anyone started as a node.js user and 'converted' or is it still more of a curious new framework?

但是流星呢?它的真正优势是什么,有什么区别?有没有人从 node.js 用户开始并“转换”或者它仍然是一个更好奇的新框架?

回答by Trevor Burnham

A loose analogy is, "Meteor is to Node as Rails is to Ruby." It's a large, opinionated framework that uses Node on the server. Node itself is just a low-level framework providing functions for sending and receiving HTTP requests and performing other I/O.

一个松散的类比是,“Meteor 之于 Node,就像 Rails 之于 Ruby。” 这是一个大型的、固执己见的框架,它在服务器上使用 Node。Node 本身只是一个低级框架,提供发送和接收 HTTP 请求以及执行其他 I/O 的功能。

Meteor is radically ambitious: By default, every page it serves is actually a Handlebarstemplate that's kept in sync with the server. Try the Leaderboard example: You create a template that simply says "List the names and scores," and every time any client changes a name or score, the page updates with the new data—not just for that client, but for everyone viewing the page.

Meteor 雄心勃勃:默认情况下,它服务的每个页面实际上都是一个与服务器保持同步的Handlebars模板。试试排行榜示例:您创建一个模板,上面写着“列出姓名和分数”,每次任何客户更改姓名或分数时,页面都会更新新数据——不仅针对该客户,而且针对所有查看页。

Another difference: While Node itself is stable and widely used in production, Meteor is in a "preview" state. There are serious bugs, and certain things that don't fit with Meteor's data-centric conceptual model (such as animations) are very hard to do.

另一个区别:虽然 Node 本身很稳定并且广泛用于生产,但 Meteor 处于“预览”状态。存在严重的错误,并且某些不符合 Meteor 以数据为中心的概念模型(例如动画)的事情很难做到。

If you love playing with new technologies, give Meteor a spin. If you want a more traditional, stable web framework built on Node, take a look at Express.

如果您喜欢玩新技术,不妨试试 Meteor。如果您想要一个基于 Node 构建的更传统、更稳定的 Web 框架,请查看Express

回答by Akshat

Meteor is a framework built ontop of node.js. It uses node.js to deploy but has several differences.

Meteor 是一个构建在 node.js 之上的框架。它使用 node.js 进行部署,但有几个不同之处。

The key being it uses its own packaging system instead of node's module based system. It makes it easy to make web applications using Node. Node can be used for a variety of things and on its own is terrible at serving up dynamic web content. Meteor's libraries make all of this easy.

关键是它使用自己的打包系统而不是节点的基于模块的系统。使用 Node.js 可以轻松创建 Web 应用程序。Node 可用于多种用途,而且它本身在提供动态 Web 内容方面非常糟糕。Meteor 的库让这一切变得简单。

回答by kenyee

Meteor's strength is in it's real-time updates feature which works well for some of the social applications you see nowadays where you see everyone's updates for what you're working on. These updates center around replicating subsets of a MongoDB collection underneath the covers as local mini-mongo (their client side MongoDB subset) database updates on your web browser (which causes multiple render events to be fired on your templates). The latter part about multiple render updates is also the weakness. If you want your UI to control when the UI refreshes (e.g., classic jQuery AJAX pages where you load up the HTML and you control all the AJAX calls and UI updates), you'll be fighting this mechanism.

Meteor 的优势在于它的实时更新功能,它适用于您现在看到的一些社交应用程序,在这些应用程序中您可以看到每个人对您正在处理的内容的更新。这些更新的中心是复制 MongoDB 集合的子集作为本地 mini-mongo(它们的客户端 MongoDB 子集)在您的 Web 浏览器上的数据库更新(这会导致在您的模板上触发多个渲染事件)。后面关于多次渲染更新的部分也是弱点。如果您希望您的 UI 控制 UI 何时刷新(例如,加载 HTML 并控制所有 AJAX 调用和 UI 更新的经典 jQuery AJAX 页面),您将与这种机制作斗争。

Meteor uses a nice stack of Node.js plugins (Handlebars.js, Spark.js, Bootstrap css, etc. but using it's own packaging mechanism instead of npm) underneath along w/ MongoDB for the storage layer that you don't have to think about. But sometimes you end up fighting it as well...e.g., if you want to customize the Bootstrap theme, it messes up the loading sequence of Bootstrap's responsive.css file so it no longer is responsive (but this will probably fix itself when Bootstrap 3.0 is released soon).

Meteor 使用了一个很好的 Node.js 插件堆栈(Handlebars.js、Spark.js、Bootstrap css 等,但使用它自己的打包机制而不是 npm)和 MongoDB 一起用于存储层,你不必想一想。但有时你最终也会与它作斗争......例如,如果你想自定义 Bootstrap 主题,它会弄乱 Bootstrap 的响应.css 文件的加载顺序,因此它不再响应(但这可能会在 Bootstrap 时自行修复) 3.0 即将发布)。

So like all "full stack frameworks", things work great as long as your app fits what's intended. Once you go beyond that scope and push the edge boundaries, you might end up fighting the framework...

因此,就像所有“全栈框架”一样,只要您的应用程序符合预期,一切都会很好。一旦超出该范围并突破边缘界限,您最终可能会与框架抗争......