美文网首页
Node.js学习(一)

Node.js学习(一)

作者: _八神光_ | 来源:发表于2017-09-23 00:10 被阅读0次

定义

一个搭建在Chrome Javascript运行时上的平台,用于构建高速、可伸缩的网络程序。

特征

  • 事件驱动
  • 非阻塞I/O

适用项目

DIRT(data-intensive real-time)数据密集型实时程序

程序代码

Hello World HTTP 服务器

var http = require('http');
http.createServer(function(req, res) {
    res.writeHead(200, {'Content-Type: 'text/plain'});
    res.end('Hello World');
}).listen(3000);

上面是构建了一个服务器,并监听3000接口,当有请求过来时,以Hello World响应。

相关文章

网友评论

      本文标题:Node.js学习(一)

      本文链接:https://www.haomeiwen.com/subject/mmuqextx.html