node学习笔记

以前搞过一段时间的node,几个月不用,又忘记了...T_T;

准备重新学一下,再做几个项目.现在Node的版本是0.10.12,下载地址是http://nodejs.org;

在cmd里

我的node装在E盘:
-> e:
-> cd node
-> node xxx.js

//先搭建一个http服务器

var http = require('http');

http.createServer(function(req,res){
  res.writeHead(200,'text/html');  //响应头
  res.write('<p>Hello Node</p>');  //响应内容
  res.end();              //响应结束
}).listen(3000)

console.log('http server is listening at 3000 port');

...时间原因没完结

原文地址:https://www.cnblogs.com/SmileCN/p/3157579.html