How to Pass Data Between Routes in Express
<p>Suppose I have this <code>POST</code> route which receives some data.</p>
<pre class="lang-js prettyprint-override"><code>app.post('/getData', function(req, res){
  var retrievedData = req.body.exampleVariable;
   // Send data to GET method
});
</code></pre>

<p>And I have this <code>GET</code> method which renders a page, but needs the data I retrieved in the <code>POST</code> method</p>
<pre class="lang-js prettyprint-override"><code>app.get('/displayData', function(req, res){
  // Retrieve data from POST method and display it.
  res.render('/examplePage.ejs', {retrievedData : req.retrievedData});
});
</code></pre>

<p><strong>What is the best way to pass the <code>retrievedData</code> variable from the given <code>POST</code> route to the <code>GET</code> route?</strong></p>
<p>As a side note, the <code>res.render()</code> method only seems to work in <code>app.get()</code> type methods</p>