title: fetch api doesn't access to nodejs + express url
body: <p>i have a server.js which has listening port 4000. Please check below code </p>
  
  <pre><code>const port = 4000;
  
  const express = require('express')
  const cors = require('cors')
  
  const app = express()
  
  const mysql = require('mysql');
  
  const con = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "",
    database: "musteri"
  
  });
  
  con.connect(function(err) {
    if (err) throw err;
    console.log("Database Connected!");
  });
  
  app.use(cors());
  
  app.use(express.urlencoded({ extended: false }));
  
  
  // Parse JSON bodies (as sent by API clients)
  app.use(express.json());
  
  app.get('/user', function(req, res, next) {
      console.log(req);
      con.query('select * from musteri_ayarlar', function (error, results, fields) {
          if(error) throw error;
          res.send(JSON.stringify(results));
      });
  });
  
  app.listen(port, (err) =&gt; {
      if(err) { console.log(err) };
    console.log('Service Port ' + port + ' started')
  })
  
  
  </code></pre>
  
  <p>with above code listening <strong>localhost:4000/user</strong> </p>
  
  <p>i can access without any problem from chrome when i call <strong>localhost:4000/user</strong> that returns a record from mysql.</p>
  
  <p>My problem started when i call <strong>localhost:4000/user</strong> adress from fetch api.</p>
  
  <p>it saying <strong>POST <a href="http://localhost:4000/user" rel="nofollow noreferrer">http://localhost:4000/user</a> 404 (Not Found)</strong></p>
  
  <p>Here is my fetch code from app.jsx</p>
  
  <pre><code>  componentDidMount() {
      const requestOptions = {
          method: 'POST',
          headers: {
            'Accept': 'application/json',
            'Access-Control-Allow-Origin':'*',
            'Content-Type': 'applications/json'
          },
          body: JSON.stringify({ username: "John", password: 30 })
      };
  
      fetch(`http://localhost:4000/user`, requestOptions)
      .then(handleResponse =&gt; handleResponse.text())
      .then(user =&gt; {
          console.log(user);
          localStorage.setItem('user', JSON.stringify(user));
          return user;
  
      });
  
    }```
  
  What is wrong with my fetchAPI code? Thanks.
  </code></pre>