title: Express JS render view with received image
body: <p>I am working with two <code>Express JS</code> applications one is an <code>API</code> and second is application that is using this <code>API</code> by making requests and displaying received informations to user.</p>
  
  <p>In <code>API</code> route I'm sending image as response:</p>
  
  <pre><code>router.get('/:customer_id',authController.isAuthenticated,(req,res) =&gt; {
      .
      . Retrieving customer data
      .
  
      return res.sendFile('/uploads/'+foundCustomer.doc_path);
  });
  </code></pre>
  
  <p>And later another application is getting this <code>document</code>:</p>
  
  <pre><code>router.get('/:customer_id',(req,res) =&gt; {
      var options = {
      url: 'http://'+config.API.user+':'+config.API.password+'@'+config.API.host+':'+config.API.port+'/customers/'+req.params.customer_id
      };
  
      request(options,(err,response,body)=&gt;{
          return res.render('customer/show',{
              document: ?, // Send document as parameter to view
          });
      });
  });
  </code></pre>
  
  <p>In this point I want to render <code>customer/show</code>(EJS view engine) with customer <code>document</code>, but I don't want to save this document in my application files, because <code>document</code> is only needed to display in view (customer details and document are stored in another application).</p>
  
  <p>I was trying to create <code>temporary</code> directory in my application structure, but it is difficult to manage deleting those not needed documents (Application has many <code>users</code> and at the same time many <code>customers</code> can be displayed).</p>
  
  <p>Another solution that I was trying to implement is to make <code>Ajax</code> request on client side and latter append received document to <code>&lt;object data='document'&gt;</code>. But this request has to be authenticated with <code>user</code> and <code>password</code>, so I realised that storing credentials on client side javascript is not the best idea...</p>
  
  <p>I am not sure that is it even possible to <code>render</code> and display image without saving in application files?</p>
  
  <p>I would be grateful for any help, maybe the best workaround is to somehow manage <code>temporarily</code> saved documents.</p>