简体   繁体   English

node.js的目标域

[英]Target domain of node.js

I am just wondering how node.js is compared to other frameworks. 我只是想知道node.js如何与其他框架进行比较。 Is it possible to develop rich internet applications using node.js? 是否可以使用node.js开发富Internet应用程序? How is it compared to java NIO? 它与java NIO相比如何? In short I am looking for the target domain of Node.js 总之,我正在寻找Node.js的目标域

not sure why there are people voting to close this question when I think it's perfectly viable, Node.JS is a new server side framework that is still undergoing heavy development. 我不确定为什么当我认为它完全可行时,有人投票决定关闭这个问题,Node.JS是一个新的服务器端框架,仍在进行大量开发。

to answer your question may be a little difficult for myself as I know nothing of Java, but I know a little about Node and use it on a regular basis whilst it's under development. 回答你的问题可能对我自己有点困难,因为我对Java一无所知,但我对Node有一点了解并定期使用它,而它正处于开发阶段。

Node JS is basically a framework built up of several components that are built for speed, such as Google's Javascript Engine (V8), it was originally designed for Google Chrome but released as an Open Source project. Node JS基本上是一个由几个为速度而构建的组件构建的框架,例如Google的Javascript Engine(V8),它最初是为谷歌Chrome设计的,但是作为开源项目发布。

Many developers have taken V8 and placed it on the server, combining it with custom libraries integrated into V8 to allow File I/O and network access. 许多开发人员已将V8放在服务器上,将其与集成到V8中的自定义库相结合,以允许文件I / O和网络访问。

So what is Node.JS 什么是Node.JS

Node JS is basically Googles V8 javascript engine as the language platform, Mixed in with Lib Event, which is a technique of using 1 thread to perform multiple tasks by creating Events from the kernel. Node JS基本上是Googles V8 javascript引擎作为语言平台,与Lib Event混合使用,这是一种使用1个线程通过从内核创建事件来执行多个任务的技术。

The primary usage of Node it's it's networking functionality, Ryan has contributed a really powerful HTTP Library that has helped it take of with Web Services, which is what it's main intention is for. Node的主要用途是它的网络功能,Ryan贡献了一个非常强大的HTTP库,它帮助它采用了Web服务,这是它的主要目的。

Why do I use NodeJS 为什么我使用NodeJS

I like Node JS simply because it's easy, fast and very modular, being able to supply information such as Files, Images, Text to a web browser directly from the Servers Memory (RAM) in under 10 lines simply helps understand the power behind it. 我喜欢Node JS只是因为它简单,快速且非常模块化,能够直接从10行以下的服务器内存(RAM)向Web浏览器提供文件,图像,文本等信息,这有助于理解它背后的力量。

For instance, Nearly every web-browser makes a request for favicon.ico , which is usually ~10KB, Now if i had 100 Requests per second and every request was requesting my favicon, my hard drive would have to locate that file, blocking all other reads in the mean time. 例如,几乎每个网络浏览器都会请求favicon.ico ,通常为10KB,现在如果我每秒有100个请求并且每个请求都请求我的favicon,我的硬盘驱动器必须找到该文件,阻止所有其他读取的同时。

I can just load the data, store it within a variable and send it to every client much much faster then the traditional methods. 我可以加载数据,将其存储在变量中,并将其发送到每个客户端,比传统方法快得多。

What's the best part about Node.JS Node.JS最棒的部分是什么?

The best part about node.js personally is the concept, the idea of being able to search thousands of clients concurrently without blocking any other client is the drive behind the speed, every thing is speed motivated, hence Google V8, it's called V8 for a reason, Lib Event, it's removes the requirement for loads of threads, which can be heavy on resources. 关于node.js个人最好的部分就是这个概念,能够在不阻挡任何其他客户端的情况下同时搜索数千个客户端的想法是速度背后的驱动,每件事都是速度激励的,因此Google V8,它被称为V8 for a理由,Lib事件,它消除了对线程负载的要求,这对资源来说可能很重要。

Getting Started 入门

I seems like you have not really had a play with Node.JS, and if you have not then is suggest you isntall it and have a play for a few days, Join there IRC Chat and speak to some of the guys over there, there is usually a member of the immediate team there that will help you. 我好像你没有真正玩过Node.JS,如果你还没有,那么建议你不要这么做并玩几天,加入IRC聊天并与那里的一些人交谈,那里通常是那里的直接团队成员,可以帮助您。

You can simply install node.JS on Ubuntu like so (In Bash): 你可以简单地在Ubuntu上安装node.JS(在Bash中):

if you do not have git 如果你没有git

sudo apt-get install git-core

install node JS: 安装节点JS:

cd /etc/
sudo git clone git://github.com/joyent/node.git
cd node
sudo ./configure
sudo make
sudo make install

to test make sure you have it installed 测试确保你已安装它

node --version

if you get the version your ready to go, go to your home directy 如果你准备好了你的版本,请直接去你家

cd ~/
mkdir Nodes
cd Nodes/

create a simple file in you ~/Nodes Directory called test.js and start away, you can run the code lie so: 在你的〜/ Nodes目录中创建一个名为test.js的简单文件并开始,你可以运行代码谎言:

cd ~/Nodes
node test.js

I had written that small guide to setting NodeJS up not just for yourself but for others who may read this and would like to set things up. 我写了一个关于设置NodeJS的小指南,不仅仅是为了你自己,也为那些可能会阅读这个并且想要设置的人提供。

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

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