title: How to change port using fetch and request react js?
body: <p>This is the code I took from my professor's tutorial. LoginComp is just {username: '', password: ''}</p>
  <pre><code>const request = new Request(&quot;/users/login&quot;, {
      method: &quot;post&quot;,
      body: JSON.stringify(loginComp),
      headers: {
          Accept: &quot;application/json, text/plain, */*&quot;,
          &quot;Content-Type&quot;: &quot;application/json&quot;
      }
  });
  
  // Send the request with fetch()
  fetch(request)
      .then(res =&gt; {
          if (res.status === 200) {
              return res.json()
  
  
          }
      })
  
      .catch(error =&gt; {
          console.log(error);
      });
  </code></pre>
  <p>I have a backend server running at localhost:5000 with post routes at localhost:5000/users/login. The issue with this code is it assumes users/login is at localhost 3000 so I would get this error in console:</p>
  <pre><code>POST http://localhost:3000/users/login 404 (Not Found)
  </code></pre>
  <p>How do I make it so its localhost:5000 not 3000 (the client server)</p>