title: How do I check if query string has values in Express.js/Node.js?
body: <p>How do I check if a query string passed to an Express.js application contains any values? If I have an API URL that could be either: <code>http://example.com/api/objects</code> or <code>http://example.com/api/objects?name=itemName</code>, what conditional statements work to determine which I am dealing with?</p>
  
  <p>My current code is below, and it always evaluates to the 'should have no string' option. </p>
  
  <pre><code>if (req.query !== {}) {
      console.log('should have no query string');
  }
  else {
      console.log('should have query string');
  }
  </code></pre>