title: NodeJS (Express) - app.delete route not working
body: <p>Working on understanding CRUD basics with setting up simple routes from my HTML5 doc to Postgres database. My GET and POST buttons are working but my DELETE is not deleting from my database. I realize the routes all look very similar (and tried renaming them to see if it would hit the callback function that is linked to the database, but it didn't work). Can anyone tell me why my HTML5 form is not working with my route to reach the database for DELETE? Thanks!</p>
  
  <p>I will only include the code I'm referring to as I have all the other code working well. Starting with showing the crappy HTML first, then the index.js with the routes, and then the queries.js with the database queries. (  ////// seperate the documents where the code is pulled :) )</p>
  
  <pre><code> &lt;h1&gt;Let's DELETE ONE Human&lt;/h1&gt;
      &lt;form action="/users/:id" method="delete"&gt;
          ID:&lt;input type="number" name="id"&gt;
          &lt;input type="submit" name=""&gt;
      &lt;/form&gt;
  
      /////////////////////////////////////////////////////////////////
  
      app.get('/', (request, response) =&gt; {
        response.sendFile(path.join(__dirname + '/html/homepage.html'))
      }, db.getUsers)
  
      app.get('/newHuman.html', (request, response) =&gt; {
        response.sendFile(path.join(__dirname + '/html/newHuman.html'))
      })
      app.get('/users', db.getUsers)
      app.get('/users/:id', db.getUserById)
      app.post('/users', db.createUser)
      app.put('/users/:id', db.updateUser)
      app.delete('/users/:id', db.deleteUser)
  
      app.listen(port, () =&gt; {
        console.log(`App running on port ${port}.`)
      })
    ////////////////////////////////////////////////////////////////////////
  
  const deleteUser = (request, response) =&gt; {
        const id = parseInt(request.query.id)
  
        pool.query('DELETE FROM users WHERE id = $1', [id], (error, results) =&gt; {
          if (error) {
            throw error
          }
          response.status(200).send(`User deleted with ID: ${id}`)
        })
      }
  </code></pre>
  
  <p><strong>TL;DR</strong><br>
  How can I send to the correct route (even with just POSTing twice) from my HTML when the app.delete and app.put have the exact same route? Tried renaming route, didn't work but I know you shouldn't have to rename for it to work. Here are routes:</p>
  
  <p>app.put('<strong>/users/:id</strong>', db.updateUser)
  app.delete('<strong>/users/:id</strong>', db.deleteUser)</p>