I'm kind of new to async in Node.JS and callbacks. Could you please let me know if this is the right way to have an async call?
function myFunc(schema) {
async.each(Object.keys(schema), function(variable) {
for (item in schema[variable]) {
for (field in schema[variable][item]) {
// Some operations go here
}
createDB(item, schema[variable][item]);
}
});
}
function CreateDB(name, new_items) {
ddb.createTable(selected_field.name, {hash: ['id', ddb.schemaTypes().number],
range: ['time', ddb.schemaTypes().string],
AttributeDefinitions: new_items
},
{read: 1, write: 1}, function(err, details) {
console.log("The DB is now created!");
});
}
Thanks