title: node.js keystoneJS render view after file upload
body: <p>I'm using keystone.js, which uses express.js and jade, and the pdf-extract npm module.</p>
  
  <p>I'm trying to setup an upload form which extracts a PDF and renders the text in a view in keystone.js.</p>
  
  <p>I'm having trouble rendering the view on pdf-extract processor complete event. It looks like I have recursion. I have this route, upload.js</p>
  
  <pre><code>exports = module.exports = function(req, res) {
  
  var view = new keystone.View(req, res),
      locals = res.locals;
  
  // Set locals
  locals.section = 'upload';
  locals.formData = req.body || {};
  locals.validationErrors = {};
  
  view.on('post', { action: 'upload' }, function(next) {
         ...
         ...file upload code
         ...
         var processor = pdf_extract(absolute_path_to_pdf, options, function(err) {
           if (err) {
             res.end(util.inspect(err));
           } 
         });
         processor.on('complete', function(data) {
           view.render('upload', {jadeVar:data.text_pages});
           next();
         }); //on processor.complete
      });  //on view.post
  view.render('upload');  //render on no post
  </code></pre>
  
  <p>This outputs about two dozen errors from pdf-extract about uploaded file not found in a recursive fashion.</p>
  
  <p>If I do this:</p>
  
  <pre><code>processor.on('complete', function(data) {
    res.end(util.inspect(data.text_pages));
  });
  </code></pre>
  
  <p>I get the extracted pdf text I want directly to the browser without the "upload" view. I am trying to take that output and send it to the "upload" view.</p>