1,编写代码
2,运行服务器
3,源码地址
1,编写代码
创建一个js文件,名字为01hello.js,编写代码
/**
* Created by boy on 2017/7/10.
*/
var http = require(
"http");
http.createServer(function (request, response) {
response.writeHead(
200, {
'Content-Type':
'text/plain'});
response.end(
'Hello World\n');
}).listen(
8888);
console.log(
'Server running at http://localhost:8888/');
2,运行服务器
(1)进入项目目录 (2)运行nodejs。 (3)在浏览器输入http://localhost:8888/,如果出现hello world信息就成功。
3,源码地址
http://download.csdn.net/download/wzjisking/9893727