       console.log(err);
                response.send(500, err);
            }
        });
    };

    var dbExists = function(response, dbName) {
        nano.db.list(function(err, body) {
            var dbFound = false;
            // body is an array
            body.forEach(function(db) {
                console.log(db);
                if (db === dbName) {
                    console.log(&#39;database exists&#39;);
                    dbFound = true;
                }
            });
            
   