NodeJS开发环境配置

"Node.js 是服务器端的 JavaScript 运行环境,它具有无阻塞(non-blocking)和事件驱动(event-driven)等的

特色,Node.js 采用 V8 引擎,同样,Node.js 实现了类似 Apache 和 nginx 的web服务,让你可以通过它来

搭建基于 JavaScript 的 Web App。"

配置NodeJS环境

我的环境是VS2013 + nodejs + nodejstools
nodejs:
http://nodejs.org
codeplex:  https://nodejstools.codeplex.com

NodeJS开发环境配置

示例

NodeJS开发环境配置
var http = require(‘http‘);
var port = process.env.port || 1337;
//加载文件模块
var fs=require(‘fs‘); 
http.createServer(function (req, rep) {
    rep.writeHead(200, { ‘Content-Type‘: ‘text/plain‘ });
     fs.readFile(‘package.json‘,‘utf-8‘,function(err,data){ 
       if (err) {
           console.log(err);
       }else{  
         rep.write(data);
         rep.end(‘Hello World\n‘);
      }
     });
}).listen(port);
console.log(‘NodeJS Server running!‘);
NodeJS开发环境配置

Refer:
http://nodejstools.codeplex.com/documentation
http://www.hanselman.com/blog/IntroducingNodejsToolsForVisualStudio.aspx

NodeJS开发环境配置,布布扣,bubuko.com

NodeJS开发环境配置

上一篇:oracle惯用缩写的含义


下一篇:JQuery中的省市联动