初识Nodejs
什么是Nodejs
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
基础
- 基于google v8 JavaScript引擎(C/C++)的
JavaScript运行时
机制
事件驱动
没有I/O阻塞
体量和效率
轻量
高效
资源
- 世界上
最大的开源库
谁在用
-
Paypal
Built almost twice as fast with fewer people
Written in 33% fewer lines of code
Constructed with 40% fewer files
-
阿里
- egg及其生态
-
其它
沃尔玛、IBM、Microsoft、Google
Autodesk、沪江、美团、饿了么
为什么
-
它适合Web场景
Web场景:低运算、高并发、高I/O
Node:事件驱动、异步I/O
-
它有合适的节奏
业务场景:高效沟通、快速开发
JavaScript:前后端统一语言、脚本语言
-
它有合适的工具
需求:大量的前端、后端各种需求
Npm:最大的开源库,全都是前后端的工具