title: How to get Express Node route to wait for function before rendering
body: <p>I am trying to get a route to wait for an async function in another module to return before render runs, but no matter what I do, <code>res.render</code> always runs first. 
  This is my current code, which actually just freezes and never loads:</p>
  
  <pre><code>router.get('/', function(req, res, next) {
    try {
      const cities = spreadsheet.getData()
  
    } catch(err) {
      console.log(err)
    }
  
    res.render('index', { cities: cities})
  })
  </code></pre>
  
  <p>and the function it is waiting for is this:</p>
  
  <pre><code>exports.getData = function () {
    parsedData = [];
    accessSpreadsheet().then(function(data) {
      console.log(parsedData)
      return parsedData;
    });
  };
  
  const accessSpreadsheet = async() =&gt; {
    await doc.useServiceAccountAuth({
        client_email: process.env.GOOGLE_SERVICE_ACCOUNT_EMAIL,
        private_key: process.env.GOOGLE_PRIVATE_KEY,
      });
    const loadedDoc =  await doc.loadInfo();
    sheet = await doc.sheetsByIndex[0];
    const cells = await sheet.loadCells(allCells[cellsIndex]);
    const data = await parseData();
    const moreCells = await checkNextCells()
  
    return;
  }
  </code></pre>
  
  <p>The render runs first, and the <code>parsedData</code> prints in the console. I also tried making the route async, and I tried <code>res.render</code> inside a callback. Is there any way to make this work?</p>