Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
hello.js
helloClient.js
readme.htm
web.config

readme.htm

<html>
<head>
    <title>helloworld sample</title>
    <style>
        pre
        {
            background-color: eeeeee;
        }
    </style>
</head>
<body>
    <h2>
        helloworld</h2>
    <p>
        The title says it all. Key points are:</p>
    <ul>
        <li>An IIS handler for node.js must be registered in web.config to designate the hello.js
            file as a node.js application. This allows other *.js files in this web application
            to be served by IIS as static client side JavaScript files.</li>
        <li>The node.js listen address must be specified as 'process.env.PORT' when starting
            the listener. When an application is hosted in IIS, the web server controls the
            base address of the application, which is provided to the node process via an environment
            variable. </li>
        <li>node.js applications can exist side by side with other content types: HTML files,
            client side JavaScript files, ASP.NET, PHP, WCF, ...</li>
    </ul>
    visit the node.js endpoint at <a href="hello.js">hello.js</a><br />
    debug node.js endpoint at <a href="hello.js/debug" target="_blank">hello.js/debug</a> (requires WebKit enabled browser)<br />
    get a client side JavaScript file from <a href="helloClient.js">helloClient.js</a>
    <p>
        <b>code</b></p>
    <pre>var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/html'});
        res.end('Hello, world! [helloworld sample; iisnode version is ' 
          + process.env.IISNODE_VERSION + ', node version is ' + process.version + ']');
}).listen(process.env.PORT);  </pre>
    <p>
        <b>web.config</b></p>
    <pre>&lt;configuration&gt;
  &lt;system.webServer&gt;

    &lt;!-- indicates that the hello.js file is a node.js application 
    to be handled by the iisnode module --&gt;

    &lt;handlers&gt;
      &lt;add name="iisnode" path="hello.js" verb="*" modules="iisnode" /&gt;
    &lt;/handlers&gt;
    
  &lt;/system.webServer&gt;
&lt;/configuration&gt;</pre>
</body>
</html>