title: NodeJS REST API and res.json/res.send
body: <p>I'm building a REST API in nodejs, and would like to verify data params before doing anything else.</p>
  
  <p>Can I simply do:</p>
  
  <pre><code>(req.body.X != XYZ)
    res.json({ error: fail })
  
  // continue
  </code></pre>
  
  <p>Or should I do:</p>
  
  <pre><code>if (req.body.X != XYZ) {
    res.json({ error: fail })
  } else {
    // continue
  }
  </code></pre>