title: Express framework and Promises - what to return from a route handler?
body: <p>I have been using the following promise-based template for my Express route handlers:</p>
  
  <pre><code>app.get('/accounts/:id', function(req, res) {
  
      AccountService.getAccount(req.params.id)
          .then(function(account) {
              res.send(account);
              //----- then must return a promise here -----
          })
          .catch(function(error) {
              res.status(500).send({'message': error.toString()});
          });
  });
  </code></pre>
  
  <p>While this code works perfectly fine, I am uncomfortable that the <code>onFulfilled</code> function is not returning a promise. This is required by the <a href="https://promisesaplus.com/" rel="nofollow">Promise Specification</a>: <em>then must return a promise</em>. Is there a better way to code this?</p>