fetching POST data from API (node js, react)
<p>I am attempting to make a POST request to my API. The handler currently looks like this...</p>

<pre><code>app.post('/login', function(req, res, next) {
    console.log("here");
    ...
});
</code></pre>

<p>This API is hosted on localhost 8080. And I am fetching the data as so...</p>

<pre><code>fetch('http://localhost:8080/login', {
        method: 'post',
        headers: {
         'Accept': 'application/json',
         'Content-Type': 'application/json'
        },
        body: JSON.stringify({
         username: this.state.username,
         password: this.state.password
        })
    });
</code></pre>

<p>What I am passing is irrelevant for the moment, I just want to make a successful POST request. When I submit the form, it fetches the API, and this is the message I get on the console...</p>

<pre><code>OPTIONS /login 200 8.177 ms - 4
</code></pre>

<p>It looks as if something worked, but it did not, the <code>console.log("here");</code> never gets called.</p>

<p>I believe I am not calling the API properly. If I remove the headers, the POST call is made, however I believe I need these headers because they are important for passing data to the <code>response</code>. What should I do?</p>