app/services/discovery.js
/**
 * Query for 5 documents using the Watson Discovery Service
 * @param {string} topic - The topic to query for
 * @returns {promise}
 */
Query for 5 documents using the Watson Discovery Service
@param {string} topic - The topic to query for
@returns {promise}
Query for 5 documents using the Watson Discovery Service @param { string } topic - The topic to query for @returns { promise }
function query(topic) {
  var promise = new Promise(function(resolve, reject) {
    discovery.query({
      environment_id : config.DISCOVERY.env_id,
      collection_id  : 'news-en',
      query          : topic,
      count          : NUM_DOCS_TO_QUERY
    }, function(error, data) {
      if (error) {
        reject(error);
      } else {
        resolve(data);
      }
    });
  });
  return promise;
}
function query ( topic ) { var promise = new Promise ( function ( resolve , reject ) { discovery . query ( { environment_id : config . DISCOVERY . env_id , collection_id : 'news-en' , query : topic , count : NUM_DOCS_TO_QUERY } , function ( error , data ) { if ( error ) { reject ( error ) ; } else { resolve ( data ) ; } } ) ; } ) ; return promise ; }
Query for 5 documents using the Watson Discovery Service
 @param {string} topic - The topic to query for
 @returns {promise}
Query for 5 documents using the Watson Discovery Service @param { string } topic - The topic to query for @returns { promise }