在D盘建立 a.js 文件。
代码内容:
`var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');`
然后启动CMD 进入D盘执行 `node a.js`
![2015-08-08/55c5a1072f8ab](https://box.kancloud.cn/2015-08-08_55c5a1072f8ab.png)
![2015-08-08/55c5a10adfe63](https://box.kancloud.cn/2015-08-08_55c5a10adfe63.png)
Server running at http://127.0.0.1:1337/
![2015-08-08/55c5a116a800a](https://box.kancloud.cn/2015-08-08_55c5a116a800a.png)
代码运行成功!