I'm the gatekeeper of my own destiny

导航

iisnode托管node

1、官方下载iisnode https://github.com/tjanczuk/iisnode

2、安装完成后在IIS中可见

3、在webconfig中设置处理

  <system.webServer>
    <handlers>
      <!-- indicates that the server.js file is a node.js application to be handled by the iisnode module -->
      <add name="iisnode" path="server.js" verb="*.js" modules="iisnode" />
    </handlers>
  </system.webServer>

4、一起来搭建我们的server.js吧!

  

var http = require('http');
var express = require('express');
 http.createServer(function (req, res) {

res.writeHead(200, {'Content-Type': 'text/plain'});

  res.end('hello world');

}).listen(process.env.PORT);

5、赶快打开我们的server.js看看"hello world"吧

posted on 2014-08-17 20:09  Wishbay  阅读(240)  评论(0编辑  收藏  举报