server.js
// Add a word to the database
Add a word to the database
Add a word to the database
function addWord(word, definition) {
  return new Promise(function(resolve, reject) {
      client.execute(
          "INSERT INTO grand_tour.words(my_table_id, word, definition) VALUES(?,?,?)", [uuid.v4(), word, definition], { prepare: true },
          function(error, result) {
              if (error) {
                  console.log(error);
                  reject(error);
              } else {
                  resolve(result.rows);
              }
          }
      );
  });
}
function addWord ( word , definition ) { return new Promise ( function ( resolve , reject ) { client . execute ( "INSERT INTO grand_tour.words(my_table_id, word, definition) VALUES(?,?,?)" , [ uuid . v4 ( ) , word , definition ] , { prepare : true } , function ( error , result ) { if ( error ) { console . log ( error ) ; reject ( error ) ; } else { resolve ( result . rows ) ; } } ) ; } ) ; }
Add a word to the database
Add a word to the database