index.js
function(serv, conf) {
    
    if(conf.auth) {
        var basicAuth = require('http-auth');
    
        var basic = basicAuth.basic({
                realm: "Closed Area."
            }, function (username, password, callback) { // Custom authentication method.
                callback(username === conf.auth.user && password === conf.auth.pass);
            }
        );
        
        return http.createServer(basic, createServer)
        
    } else {
    
        return http.createServer(createServer)
    
    }
}
function(serv, conf) {
    
    if(conf.auth) {
        var basicAuth = require('http-auth');
    
        var basic = basicAuth.basic({
                realm: "Closed Area."
            }, function (username, password, callback) { // Custom authentication method.
                callback(username === conf.auth.user && password === conf.auth.pass);
            }
        );
        
        return http.createServer(basic, createServer)
        
    } else {
    
        return http.createServer(createServer)
    
    }
}
/*
setInterval(function() {
console.log(parseInt(process.memoryUsage().rss / 1024 / 1024))
}, 3000)