title: why isn't my form data (using fetch API ) communicated between client and server?
body: <p><strong>disclaimer...</strong></p>
  <p>Looking for some help, I understand this question has been asked (in various ways) before. - However, I've only been coding for some time so relatively new...go easy! ;-)</p>
  <p><strong>My Issue...</strong></p>
  <p>I currently have a react form set up as a functional component, see below:</p>
  <pre><code>import React, { Fragment, useState } from &quot;react&quot;;
  
  
  const EmailForm = () =&gt; {
  
      const [inputs, setInputs] = useState({
        email: &quot;&quot;,
        subject: &quot;&quot;,
        message: &quot;&quot;,
      });
    
      const { email, subject, message } = inputs;
    
      const onChange = e =&gt;
        setInputs({ ...inputs, [e.target.name]: e.target.value });
    
      const onSubmitForm = async e =&gt; {
  
        e.preventDefault();
        try {
  
        const test = { email, subject, message };
  
        const options = {
          method: 'POST',
          headers: {&quot;Content-type&quot;: &quot;application/json&quot;, jwt_token: localStorage.token } ,
          body: JSON.stringify(test)
        }
  
       fetch(&quot;http://localhost:5000/dashboard/&quot;, options)
  
        console.log(test, 'SUBMIT')    
      
      } catch (err) {
          console.error(err.message);
        }
      }; 
  
    
      return (
        &lt;Fragment&gt;
          &lt;form onSubmit={onSubmitForm}&gt;
            &lt;input
              type=&quot;text&quot;
              name=&quot;email&quot;
              placeholder=&quot;email&quot; 
              value={email}
              onChange={e =&gt; onChange(e)}
              className=&quot;form-control my-3&quot;
            /&gt;
            &lt;input
              type=&quot;text&quot;
              name=&quot;subject&quot;
              placeholder=&quot;subject&quot;
              value={subject}
              onChange={e =&gt; onChange(e)}
              className=&quot;form-control my-3&quot;
            /&gt;
            &lt;input
            type=&quot;textarea&quot;
            name=&quot;message&quot;
            placeholder=&quot;message&quot; 
            rows=&quot;10&quot;
            cols=&quot;50&quot;
            value={message} 
            onChange={e =&gt; onChange(e)}
            className=&quot;form-control my-3&quot;
            /&gt;
  
            &lt;button class=&quot;btn btn-success btn-block&quot;&gt;Submit&lt;/button&gt;
          &lt;/form&gt;
        &lt;/Fragment&gt;
      );
    };
  
  
  export default EmailForm;
  </code></pre>
  <p>However, once <code>onSubmitForm</code> is actioned I want the form's content (IE - message,email,subject) to be sent to my server in node.js.</p>
  <p>I currently have the following set up as a server JS file but when i press the submit button nothing is logged to the console OR in my node.js terminal.</p>
  <pre><code>const express = require(&quot;express&quot;);
  const app = express();
  const cors = require(&quot;cors&quot;);
  
  
  //middleware
  
  app.use(cors());
  app.use(express.json());
  
  //emailForm
  
  app.post(&quot;http://localhost:5000/dashboard/&quot;), (req, res) =&gt; {
    console.log('i got a message');
    console.log(req.body);
  }
  
  app.listen(5000, () =&gt; {
    console.log(`Server is starting on port 5000`);
  });
  </code></pre>
  <p>I'm sure it's something really obvious, but any help would be much appreciated. Any ideas?</p>
  <p>Thanks team!</p>