Listen to process.env.PORT
and fallback to port 8001 will make your life easier. By default process.env.PORT
is set to port 80.
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});