node.js 到底是做什么用的?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4531649/
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 13:47:07  来源:igfitidea点击:

What exactly is node.js used for?

node.js

提问by Manuel de Leon

Is it a web server or a programming language for server-side scripts?

它是 Web 服务器还是服务器端脚本的编程语言?

采纳答案by Ahmad Alfy

From Node.js website

来自Node.js 网站

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Node.js 是一个基于 Chrome 的 JavaScript 运行时构建的平台,用于轻松构建快速、可扩展的网络应用程序。Node.js 使用事件驱动的非阻塞 I/O 模型,使其轻量级和高效,非常适合跨分布式设备运行的数据密集型实时应用程序。

Event-driven means that the server only reacts when an event occurs. This allow us to create high performance, highly scalable, “real-time” applications.

事件驱动意味着服务器仅在事件发生时做出反应。这使我们能够创建高性能、高度可扩展的“实时”应用程序。

Finally, this is probably the best articlethat will get you excited about Node.js

最后,这可能是让您对 Node.js 感到兴奋的最佳文章

回答by Ivo Wetzel

Directly from the node.jstag wiki, make sure watch some of the talk videos linked there to get a better idea.

直接从node.js标签 wiki,确保观看链接到那里的一些谈话视频以获得更好的想法。



Node.jsis an event based, asynchronous I/O framework that uses Google's V8 JavaScript Engine.

Node.js是一个基于事件的异步 I/O 框架,它使用 Google 的V8 JavaScript 引擎

Node.js - or just Node as it's commonly called - is used for developing applications that make heavy use of the ability to run JavaScriptboth on the client, as well as on server side and therefore benefit from the re-usability of code and the lack of context switching.

Node.js - 或通常称为 Node - 用于开发大量利用在客户端和服务器端运行JavaScript的能力的应用程序,因此受益于代码的可重用性和缺乏上下文切换。

It's also possible to use matured JavaScript frameworks like YUIand jQueryfor server side DOM manipulation.

也可以使用成熟的 JavaScript 框架(如YUIjQuery)进行服务器端 DOM 操作。

To ease the development of complex JavaScript further, Node.js supports the CommonJSstandard that allows for modularized development and the distribution of software in packages via the Node Package Manager.

为了进一步简化复杂 JavaScript 的开发,Node.js 支持CommonJS标准,该标准允许通过Node Package Manager进行模块化开发和包中的软件分发。

Applications that can be written using Node.js include, but are not limited to:

可以使用 Node.js 编写的应用程序包括但不限于:

  • Static file servers
  • Web Application frameworks
  • Messaging middle ware
  • Servers for HTML5 multi player games
  • 静态文件服务器
  • 网络应用程序框架
  • 消息中间件
  • 用于 HTML5 多人游戏的服务器

回答by Jazeb_007

What can we build with NodeJS:

我们可以用 NodeJS 构建什么:

  • REST APIs and Backend Applications
  • Real-Time services (Chat, Games etc)
  • Blogs, CMS, Social Applications.
  • Utilities and Tools
  • Anything that is not CPU intensive.
  • REST API 和后端应用程序
  • 实时服务(聊天、游戏等)
  • 博客、CMS、社交应用程序。
  • 实用程序和工具
  • 任何不占用 CPU 的东西。

回答by mdashikar

The Developers Survey from Stack Overflow is a good source of information for you to start this research.

Stack Overflow 的开发人员调查是您开始这项研究的良好信息来源。

2017: https://insights.stackoverflow.com/survey/2017#most-popular-technologies

2017 年:https: //insights.stackoverflow.com/survey/2017#most-popular-technologies

2016: https://insights.stackoverflow.com/survey/2016#technology-most-popular-technologies

2016 年:https: //insights.stackoverflow.com/survey/2016#technology-most-popular-technologies

Why the Hell Would You Use Node.js

你到底为什么要使用 Node.js

https://medium.com/the-node-js-collection/why-the-hell-would-you-use-node-js-4b053b94ab8e

https://medium.com/the-node-js-collection/why-the-hell-would-you-use-node-js-4b053b94ab8e

Where Node.js really shines is in building fast, scalable network applications, as it's capable of handling a huge number of simultaneous connections with high throughput, which equates to high scalability. How it works under-the-hood is pretty interesting. Compared to traditional web-serving techniques where each connection (request) spawns a new thread, taking up system RAM and eventually maxing-out at the amount of RAM available, Node.js operates on a single-thread, using non-blocking I/O calls, allowing it to support tens of thousands of concurrent connections (held in the event loop).

Node.js 真正闪耀的地方在于构建快速、可扩展的网络应用程序,因为它能够以高吞吐量处理大量同时连接,这相当于高可扩展性。它在后台的工作方式非常有趣。与传统的 Web 服务技术相比,每个连接(请求)产生一个新线程,占用系统 RAM 并最终最大化可用 RAM 量,Node.js 在单线程上运行,使用非阻塞 I/ O 调用,允许它支持数万个并发连接(保持在事件循环中)。

回答by Abdul Alim Shakir

Node.js is exactly used for back-enddevelopment, but it is popular as a full-stackand front-endsolution as well. It is used primarily to build web applications, but it is a very popular choice for building enterprise applications too.

Node.js 完全用于后端开发,但它也作为全栈前端解决方案很受欢迎。它主要用于构建 Web 应用程序,但它也是构建企业应用程序的一个非常流行的选择。

Developers like it because of its versatility, agility and performance. It increases productivity and application performance in a significant way. Since Node.js has a long-term support(LTS) plan that provides security and stability, it's no wonder that huge enterprises constantly add it to their stacks.

开发人员喜欢它是因为它的多功能性、敏捷性和性能。它以显着的方式提高了生产力和应用程序性能。由于 Node.js 有提供安全性和稳定性的长期支持( LTS) 计划,难怪大型企业不断将其添加到他们的堆栈中。

It is non-blockingand event-driven. Node.js applications uses “Single Threaded Event Loop Model” architecture to handle multiple concurrent clients. These features are key factors to make real time web applications.

它是非阻塞事件驱动的。Node.js 应用程序使用“单线程事件循环模型”架构来处理多个并发客户端。这些功能是制作实时 Web 应用程序的关键因素。

回答by Ponmudi VN

Node.js is a runtime that compiles and executes javaScript. It can be used to develop application that runs end-to-end in JavaScript i..e both client side and server side uses javascript code unlike most of todays' application with rich client framework (angularJs, extJs) and RESTful server side APIs

Node.js 是一个编译和执行 javaScript 的运行时。它可用于开发在 JavaScript 中端到端运行的应用程序,即客户端和服务器端都使用 javascript 代码,这与当今大多数具有丰富客户端框架(angularJs、extJs)和 RESTful 服务器端 API 的应用程序不同

回答by Peter Limbach

回答by Rahul

Node.js is used for easily building fast, scalable network applications

Node.js 用于轻松构建快速、可扩展的网络应用程序

回答by GowriShankar

Node.js is an open source command line tool built for the server side JavaScript code.

Node.js 是为服务器端 JavaScript 代码构建的开源命令行工具。

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.

Node.js 是一个基于 Chrome 的 JavaScript 运行时构建的平台,用于轻松构建快速、可扩展的网络应用程序。

Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Node.js 使用事件驱动的非阻塞 I/O 模型,使其轻量级和高效,非常适合跨分布式设备运行的数据密集型实时应用程序。

The basic philosophy of node.js is:

node.js 的基本理念是:

Non-blocking I/O- every I/O call must take a callback, whether it is to retrieve information from disk, network or another process. Built-in support for the most important protocols(HTTP, DNS, TLS) Low-level.Do not remove functionality present at the POSIX layer. For example, support half-closed TCP connections. Stream everything; never force the buffering of data.

非阻塞 I/O- 每个 I/O 调用都必须进行回调,无论是从磁盘、网络还是其他进程检索信息。 对最重要的协议(HTTP、DNS、TLS)的 内置支持 低级。不要删除存在于 POSIX 层的功能。例如,支持半封闭的 TCP 连接。 流式传输所有内容;永远不要强制缓冲数据。

Credit - Simple Overview About Node.js

信用 - 关于 Node.js 的简单概述