Minimal changes to existing HTTP node.js application code

We use iisnode to support the use of Node.js on IIS servers.  Most applications will only require a change in the specification of the listen address for the HTTP server, since that address is assigned by the IIS as opposed to the application to choose. The iisnode module will pass the listening address to the node.exe worker process in the PORT environment variable, and the application can read it from process.env.PORT:

var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('I am listening on ' + process.env.PORT);

Add Feedback