1 / 26
文档名称:

Node JS 入门-精品课件(PPT).ppt

格式:ppt   页数:26页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

Node JS 入门-精品课件(PPT).ppt

上传人:2768573384 2016/6/14 文件大小:0 KB

下载得到文件列表

Node JS 入门-精品课件(PPT).ppt

文档介绍

文档介绍:学****背景?会一门面向对象的语言?就有一定的编程经验?了解 JavaScript JavaScript ? JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles. -- wikipedia JavaScript 是一种基于原型的脚本语言,具有动态、弱类型和顶级函数等特性,它是一种多范式语言,支持面向对象、命令式、函数式等编程风格。 prototype-based dynamic weakly typed first-class functions multi-paradigm language object-oriented imperative functional scripting language Scripting language A scripting language is a programming language that is used to manipulate, customise , and automate the facilities of an existing system. existing system useful functionality is already available through a user interface scripting language is a mechanism for exposing that functionality to program control. existing system provide a host environment of objects and facilities 5 V8 Engine ? Google Chrome ? Google Chrome 使用使用 WebKit 作为其排版引擎,并自己开发的一个高性能的 JavaScript 引擎—— V8 ? google 的野望? ? V8 引擎?用 C++ 编写的开源 JavaScript 引擎?支持 ECMAScript V5 ?支持 Windows 、 Mac OS X 、 Linux ?支持 IA-32 、 x64 和 ARM 处理器?可以单独运行、也可以嵌入其他应用程序 V8 is host environment 6 ? 是一个工具? node 是一个命令行工具,很容易安装?可以在终端中通过命令“ node ”运行 JavaScript 程序? node 使用 V8 引擎执行 JavaScript ,性能很好? node 提供了能够访问网络和文件系统的 API ? 是一个轻量级、高效的平台?事件驱动?非阻塞 I/O 模型? DIRTy —— data-intensive real-time applications everything runs in parallel, except your code . 7 第一个 程序 var http = require('http'); ( function ( req , res) { (200, {'Content-Type': 'text/plain'}); ('Hello World\n'); }).listen(1337, ''); ('Server running at :1337/'); D:\>node Server running at :1337 8 解读?var http = require('http'); ?引入 http 模块,并将其赋值给变量 http ? (…).listen(1337, ''); ?调用 http 模块的 createServer 函数创建了一个 HTTP 服务器?指定该服务器监听本地的 1337 端口?function ( req , res) { …