title: Problem deleting from mySQL database with delete query (404 not Found)
body: <p>I have constructed a mySQL database, and I have a React.js page with items listed with delete buttons. On the click of each delete button it should remove the item. However it does not work in my case. I have tried restarting my node server, and refreshing the db table as well as refreshing the react page. None have solved the issue. I have tried multiple other things as a result of youtube and google searches but none seem to be precise in what problem i am having.</p>
  <p>Here is the code below. Is there anything noticeable that might be causing this issue?</p>
  <p>index.js (this is the node server file)</p>
  <pre><code>const express = require(&quot;express&quot;);
  const bodyParser = require(&quot;body-parser&quot;);
  const cors = require(&quot;cors&quot;);
  const app = express();
  const mysql = require(&quot;mysql&quot;);
  
  const db = mysql.createPool({
    host: &quot;localhost&quot;,
    user: &quot;root&quot;,
    password: &quot;Legion101!&quot;,
    database: &quot;cruddatabase&quot;,
  });
  
  app.use(cors());
  app.use(express.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  
  app.get(&quot;/api/get&quot;, (req, res) =&gt; {
    const sqlSelect = &quot;SELECT * FROM scrap_numbers&quot;;
    db.query(sqlSelect, (err, result) =&gt; {
      res.send(result);
    });
  });
  
  app.post(&quot;/api/insert&quot;, (req, res) =&gt; {
    const department = req.body.department;
    const summary = req.body.summary;
  
    const sqlInsert =
      &quot;INSERT INTO scrap_numbers (department, summary) VALUES (?,?)&quot;;
    db.query(sqlInsert, [department, summary], (err, result) =&gt; {
      console.log(err);
    });
  });
  
  app.delete(&quot;/api/delete/:department&quot;, (req, res) =&gt; {
    const name = req.params.department;
    const sqlDelete = &quot;DELETE from scrap_numbers where department = ?&quot;;
  
    db.query(sqlDelete, name, (err, result) =&gt; {
      if (err) console.log(err);
    });
  });
  
  app.listen(3001, () =&gt; {
    console.log(&quot;Running on port 3001&quot;);
  });
  </code></pre>
  <p>If I should also post the App.js file please let me know.
  The Database has a department column and summary column. After further testing i have found the error to be a 404 not found error. How can i fix this?</p>