hello nodejs

文章1一步:下载、安装文件

    打开nodejs官方网站http://www.nodejs.org/download/ 。选择须要的版本号。直接打开。默认安装就可以

第二步:编写測试代码:

var http = require('http');
http.createServer(function(req, res) {
    res.writeHead(200, {
        'Content-Type': 'text/plain'
    });
    res.end('Hello World
');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');

第三步:执行測试程序

进入到node的安装文件夹运行

node hello.js

看到控制台有以下输出即成功:
Server running at http://127.0.0.1:1337/


參考:http://www.cnblogs.com/beiyuu/archive/2011/07/29/install-nodejs.html
            http://blog.csdn.net/freshlover/article/details/12691031

           http://cnodejs.org/topic/4fae80c02e8fb5bc650a8360


版权声明:本文博主原创文章,博客,未经同意不得转载。

原文地址:https://www.cnblogs.com/bhlsheji/p/4868768.html