async function test() {
  const promises = [];

  let endpoint;
  for (endpoint of endpoints) {
    const url = `/${endpoint}`;
    const data = JSON.parse(globals.examples[endpoint]);

    if(endpoint !== 'Patient') {
        const read = new globals.broker
            .get(url)
            .then((response) => globals.config(response))
            .catch((error) => globals.info(error));
        promises.push(read);
    }

    const create = globals.broker
        .post(url, data)
        .then(async (response) => {
            if (response.data.id) urls.push(`${url}/${response.data.id}`);
            else if (response.data.Patient)
              // wait for references to be added to cleanup list
              await markPatients(response.data.Patient);

            globals.config(response);
            console.log(JSON.stringify(response.data));
            console.log("\n");
        })
        .catch((error) => globals.info(error));
    promises.push(create);
  }

  await Promise.all(promises);
}
/**
 * Send GET and POST requests to multiple endpoints
 */
Send GET and POST requests to multiple endpoints
Send GET and POST requests to multiple endpoints
async function test() {
  const promises = [];
  let endpoint;
  for (endpoint of endpoints) {
    const url = `/${endpoint}`;
    const data = JSON.parse(globals.examples[endpoint]);
    if(endpoint !== 'Patient') {
        const read = new globals.broker
            .get(url)
            .then((response) => globals.config(response))
            .catch((error) => globals.info(error));
        promises.push(read);
    }
    const create = globals.broker
        .post(url, data)
        .then(async (response) => {
            if (response.data.id) urls.push(`${url}/${response.data.id}`);
            else if (response.data.Patient)
              await markPatients(response.data.Patient);
            globals.config(response);
            console.log(JSON.stringify(response.data));
            console.log("\n");
        })
        .catch((error) => globals.info(error));
    promises.push(create);
  }
  await Promise.all(promises);
}
async function test ( ) { const promises = [ ] ; let endpoint ; for ( endpoint of endpoints ) { const url = ` ${ endpoint } ` ; const data = JSON . parse ( globals . examples [ endpoint ] ) ; if ( endpoint !== 'Patient' ) { const read = new globals . broker . get ( url ) . then ( ( response ) => globals . config ( response ) ) . catch ( ( error ) => globals . info ( error ) ) ; promises . push ( read ) ; } const create = globals . broker . post ( url , data ) . then ( async ( response ) => { if ( response . data . id ) urls . push ( ` ${ url } ${ response . data . id } ` ) ; else if ( response . data . Patient ) await markPatients ( response . data . Patient ) ; globals . config ( response ) ; console . log ( JSON . stringify ( response . data ) ) ; console . log ( "\n" ) ; } ) . catch ( ( error ) => globals . info ( error ) ) ; promises . push ( create ) ; } await Promise . all ( promises ) ; }
Send GET and POST requests to multiple endpoints
Send GET and POST requests to multiple endpoints
// wait for references to be added to cleanup list