简体   繁体   English

node.js 的含义是什么?

[英]What are the implications of node.js?

I've been reading about node.js lately.我最近一直在阅读有关node.js 的文章 I've seen many articles about how it's really great and all from some prominent people.我看过很多关于它真的很棒的文章,而且都来自一些知名人士。 Given the inertia that this project seems to have, and that I am currently learning javascript and jQuery, the project has gotten my attention.鉴于这个项目似乎具有惯性,而且我目前正在学习 javascript 和 jQuery,这个项目引起了我的注意。 I get that many people are excited about it, but I don't quite understand what the implications are.我知道很多人对此感到兴奋,但我不太明白其中的含义

I understand that it is event driven and non-blocking and all of that, but where I'm confused is in regards to its intent.我知道它是事件驱动和非阻塞以及所有这些,但我感到困惑的是它的意图。

Does node.js mean that we now have a foundation to run Javascript on the server-side, so that later maybe someone will create the Ruby on Rails or ASP.NET MVC equivalent for node.js/Javascript? Node.js的是否意味着我们现在必须在服务器端运行JavaScript为基础,这样以后也许会有人创造on Rails的或ASP.NET MVC相当于红宝石的Node.js / JavaScript的? Perhaps there already are web frameworks out there, but if so I haven't heard the hype machine yet.也许已经有网络框架了,但如果是这样,我还没有听说过炒作机器。

I hope my question is clear.我希望我的问题很清楚。

I think the major implications are two-fold: huge performance and scalability gains, and the possibility of creating web applications where two or more people may work on the same web application at the same time, watching what the others are doing, in real-time.我认为主要的影响有两方面:巨大的性能和可扩展性提升,以及创建 Web 应用程序的可能性,其中两个或更多人可以同时在同一个 Web 应用程序上工作,观察其他人在做什么,在现实中——时间。 This latter one not only has big implications for web-based gaming, but also collaboration tools, etc.后一种不仅对基于网络的游戏有重大影响,而且对协作工具等也有重大影响。

It would appear that node.js is exactly what the real-time web needs.看起来 node.js 正是实时网络所需要的。 For that kind of thing, be sure to also checkout Socket.IO , which achieves cross-browser HTML5 web sockets.对于这种事情,一定要检查Socket.IO ,它实现了跨浏览器的 HTML5 web sockets。 Combined with node.js, this makes for an incredible platform.结合 node.js,这构成了一个令人难以置信的平台。

Check out what was made at the node.js knockout for some examples of what can be done.查看在node.js 淘汰赛中做了什么,以了解可以做什么的一些示例。

I think what you can hope for is going to be more like twisted for Python, rather than eg rails for Ruby -- a rich, powerful framework, but still one requiring skill and care to use properly, because asynchronous programming is always like that... it's the price you pay for its absolutely awesome performance potential.我认为您可以期望的将更像是 Python 的twisted ,而不是 Ruby 的rails —— 一个丰富、强大的框架,但仍然需要技巧和小心才能正确使用,因为异步编程总是这样。 ..这是您为其绝对出色的性能潜力付出的代价。

There are and have been Javascript server-side frameworks, but with server-side Javascript never being a really popular option, such frameworks never got the "critical mass" of support and enthusiasm that, say, jQuery has, or rails for ruby on the server side of things.曾经有过 Javascript 服务器端框架,但是服务器端 Javascript 从来都不是一个真正流行的选择,这样的框架从来没有得到过“临界质量”的支持和热情,比如jQueryrails for ruby服务器端的事情。

I doubt async programming ( with its subtleness and difficulty ) will be the defining trigger for a "mass movement" ( hey, I hope I'm wrong, but I see eg the relative popularity for Python of Django, with none of the awesome performance, compared with Twisted, with _all_ the awesome performance... but the intrinsic difficulty too!- ).我怀疑异步编程(以其微妙和困难)将成为“大规模运动”的定义触发器(嘿,我希望我错了,但我看到例如 Django 的 Python 相对流行,但没有任何出色的性能, 与 Twisted 相比,_all_ 性能很棒......但也有内在的困难!- )。

OTOH other developments ( such as, simply, the wide availability of powerful, high performing, solid Javascript engines like V8 ) are more likely to eventually result in wide availability of ( non-async;- ) server-side Javascript choices, and as a consequence the possibility of the development ( or porting -- eg, a framework like dojo could already offer a lot to a JS server-side app, only parts of it are actually client-side ) of powerful, simple , and therefore eventually popular framework. OTOH 其他发展(例如,简单地说,像 V8 这样强大、高性能、可靠的 Javascript 引擎的广泛可用性)更有可能最终导致(非异步;-)服务器端 Javascript 选择的广泛可用性,并且作为因此,开发(或移植——例如,像 dojo 这样的框架已经可以为 JS 服务器端应用程序提供很多功能,只有其中的一部分实际上是客户端)的强大、简单、因此最终流行的框架的可能性. Nevertheless, I wouldn't hold my breath waiting for that either...尽管如此,我也不会屏住呼吸等待……

Node.js is an application server , not yet another webapp server. Node.js 是一个应用程序服务器,而不是另一个 webapp 服务器。 As the article says, it saves you the trouble of writing the event loop and using two languages to write apps (python/java/ruby/php backend, js frontend).正如文章所说,它省去了你编写事件循环和使用两种语言编写应用程序的麻烦(python/java/ruby/php后端,js前端)。 As it is based in the V8 Engine by Google it's really fast and has a low memory footprint.由于它基于谷歌的 V8 引擎,因此速度非常快,内存占用也很低。

There's a web service framework called GeddyJS, and Node.js comes with a set of libraries for IO, database and math.有一个名为 GeddyJS 的Web 服务框架,Node.js 带有一组用于 IO、数据库和数学的库。 It's also possible to extend it with addons, though last time I checked documentation was still a little rough on that.也可以使用插件扩展它,尽管上次我检查文档时对此仍然有些粗糙。

There is a node framework called bogart which you can easily use the MVC pattern and mustache or common-ejs for templating.有一个名为 bogart 的节点框架,您可以轻松地使用 MVC 模式和 mustache 或 common-ejs 进行模板化。

http://github.com/nrstott/bogart http://github.com/nrstott/bogart

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

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