title: How to write correct app.get()? (node.js / express / boby-parser)
body: <p>I create server (node.js / express / boby-parser)</p>
  <p>and I need to get array of objects 'users'.
  its part of code from server.js file:</p>
  <pre><code>let users = [{
      name: 'user1',
  }];
  
  app.get('/users/', (req, res) =&gt; {
      const filePath = path.join(pth.dir, 'build', 'index.html');
      res.json(users);
      res.sendFile(filePath);
  });
  </code></pre>
  <p>Its my code from frontend:</p>
  <pre><code>const handleResponse = (response) =&gt; {
      return response.text().then(text =&gt; {
          const data = text &amp;&amp; JSON.parse(text);
          if (!response.ok) {
              const error = (data &amp;&amp; data.message) || response.statusText;
              return Promise.reject(error);
          }
          return data;
      });
  };
  
  const getAll = (baseUrl) =&gt;  {
      const requestOptions = {
          method: 'GET'
      };
      return fetch(baseUrl, requestOptions).then(handleResponse);
  };
  </code></pre>
  <p>Something wrong with my code at server. (I just dodnt know how to use express server).
  when I use getAll function I got JSON text replace my page. Can anyone help? How should I write app.get() in server.js.  Or do I need write in server part one app.get() to get page or another app.get() to get JSON data?</p>