node-static
node-static copied to clipboard
Starting file server on Windows port 22 does not throw error
I am trying the following code snippet on Windows 7 using Node.js v6.2.0. The code works when using port 8080, but, when starting with port 22, it does not throw any error. Is there a way to catch it?
var static = require('node-static');
var file = new static.Server('public');
require('http').createServer(function (request, response) {
request.addListener('end', function () {
file.serve(request, response, function (err, result) {
if (err) {
console.error("Error: " + err.message);
}
});
}).resume();
}).listen(22);