node. JS Knowledge Point Learning
First, the basic concept
Node.js
, or Node, is a platform that can be JavaScript
run on the server side. It can be said that Node.js
pioneered the javascript
development of the first module, the early javascript
requirements are very simple, basically written in the function, and then the process-oriented formulation, and then slowly introduced the idea of object-oriented development, and then slowly written into the class. Finally, the advent of node. JS is beginning to have the concept of JS Modular development, which makes the bloated js
code exempt from a series of development challenges such as naming conflicts.
Node
The most important feature is the asynchronous I/O
and event-driven architecture design. Node.js
is a platform that lets JS run outside the browser. Its initial goal is to implement an event-driven, non-blocking I/O
Web server.
Node.js
It's just a JavaScript
running environment (or a set of libraries) that js
complements the standard for asynchronous IO, which is the ability to read and write networks and files. A library is nothing more than a tune API or anything except a slightly anti-human event callback, and other back-end languages (PHP, Python) are not much worse.
Node.js
Using single-threaded mode, each thread completes a function, a process can have multiple threads, and an asynchronous request for all I/O. After each asynchronous I/O request is completed, it is pushed to the event queue, awaiting processing by the program process.
In short, node
the core idea is: non-blocking, single-threaded and event-driven. (synchronization corresponds to blocking, asynchronous corresponding non-blocking)
Node.js
the reasons for ebay's choice can be summed up in the following 4 points:
动态语言:开发效率非常高,并有能力构建复杂系统,如ql.io。性能和I/O负载:Nodejs非常好的解决了IO密集的问题,通过异步IO来实现。连接的内存开销:每个Node.js进程可以支持超过12万活跃的连接,每个连接消耗大约2K的内存。操作性:实现了Nodejs对于内存堆栈的监控系统。
Node.JS
Architecture
What can node. js do? Web development: Express + EJS + mongoose/mysql
express 是轻量灵活的Nodejs Web应用框架,它可以快速地搭建网站。Express框架建立在Nodejs内置的Http模块上,并对Http模块再包装,从而实际Web请求处理的功能。ejs是一个嵌入的Javascript模板引擎,通过编译生成HTML的代码。mongoose 是MongoDB的对象模型工具,通过Mongoose框架,可以进行访问MongoDB的操作。mysql 是连接MySQL数据库的通信API,可以进行访问MySQL的操作。
Typically Node.js
, Web development requires 3 frameworks to work with, like SSH in Java.
Web chat Room (IM): Express + Socket.io
socket.io
One is a NODEJS architecture-based, supported websocket
protocol for a software package that communicates at all times. socket.io
provides a complete package for cross-browser building of real-time applications, socket.io
fully javascript
implemented.
node. JS Knowledge Point Learning