async function routeData(){
  try{
    var url  = 'https://api-v3.mbta.com/vehicles?filter[route]=1&include=trip';
    var res  = await fetch(url);
    var data = await res.text();

    // write listings to file
    var filename = getFilename();
    fs.writeFile(filename, data, function(err) {
      if (err) throw err;
      console.log(filename);
    });
  }
  catch(err){
    console.log(err);
  }
 
}
// function requests bus data from MBTA, saves data to file
function requests bus data from MBTA, saves data to file
function requests bus data from MBTA saves data to file
async function routeData(){
  try{
    var url  = 'https://api-v3.mbta.com/vehicles?filter[route]=1&include=trip';
    var res  = await fetch(url);
    var data = await res.text();
    var filename = getFilename();
    fs.writeFile(filename, data, function(err) {
      if (err) throw err;
      console.log(filename);
    });
  }
  catch(err){
    console.log(err);
  }
}
async function routeData ( ) { try { var url = 'https://api-v3.mbta.com/vehicles?filter[route]=1&include=trip' ; var res = await fetch ( url ) ; var data = await res . text ( ) ; var filename = getFilename ( ) ; fs . writeFile ( filename , data , function ( err ) { if ( err ) throw err ; console . log ( filename ) ; } ) ; } catch ( err ) { console . log ( err ) ; } }
function requests bus data from MBTA, saves data to file
function requests bus data from MBTA saves data to file
// write listings to file