title: Fetch: Can you pass parameters to the server
body: <p>I'm using a basic fetch to obtain data from an express server that queries the data from a database. So I want to do a login system, i want to send the user/password from the input fields with the fetch request. so i can perform the logical check to see if password matches the data in the server. and respond with the result.
  Is it possible to do a fetch that can pass parameters?</p>
  
  <p>Updated Code Below: </p>
  
  <pre><code>let fetchData = {
    method: "post",
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
  
    body: JSON.stringify({
      username: this.state.user,
      password: this.state.password
    })
  }
  
  var fromServer = fetch('http://localhost:3000/', fetchData)
  .then(function(response){
    if( !response.ok){
      throw Error (response.statusText);
    }
    return response.json();
  })
  .then(function(response) {
    console.log(response);
  })
  .catch(error =&gt; console.log("there was an error --&gt; " + error));
  </code></pre>
  
  <p>Express function</p>
  
  <pre><code>app.post('/', function(req, res){
    var uname = req.body.username;
    var pw = req.body.password;
    console.log(uname);
    console.log(pw);
  });
  </code></pre>