Passing parameters to the constructor of a Singleton

var Database = (function(host, username, password, database) {
    var connection = mysql.createConnection({
        host: host,
        user: username,
        password: password,
        database: database
    });

    return {
        //all my functions
    };
}());

I am trying to make a Database singleton in node to communicate with my database. But how to I pass the arguments, (host, username, password, database) into it when I call it? I cant do:

var db = new Database(HOST, USERNAME, PASSWORD, DATABASE);

since database is a singleton... Also, how do I make a constructor inside Database, and how do I pass arguments into it??

The () on the final line is the list of arguments being passed to the function, and it is currently empty. Simply put your arguments there:

var Database = (function(host, username, password, database) {
    var connection = mysql.createConnection({
        host: host,
        user: username,
        password: password,
        database: database
    });

    return {
        //all my functions
    };
}(HOST, USERNAME, PASSWORD, DATABASE));