title: Sending a DELETE request with EJS using Mongoose
body: <p>So I have already made a Restful API with node and everything works but I am trying to add EJS to it so I can use HTML&amp;CSS, I implemented GET and POST just fine but I am tripping up on DELETE.</p>
  
  <p>Here is my code in my router to delete</p>
  
  <pre><code>listRouter.delete('/:id', 
      function(req, res) {
          req.list = list;
          req.list.remove(function(err){
              if (err)
                  res.status(500).send(err);
              else
                  res.redirect('/')
          });
  });
  </code></pre>
  
  <p>and here's my EJS for deletion</p>
  
  <pre><code>&lt;form method="DELETE" action="/:id"&gt;
        &lt;button type="submit"&gt;Delete&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and this is the error I receive when I press the button</p>
  
  <pre><code>{
  message: "Cast to ObjectId failed for value ":id" at path "_id"",
  name: "CastError",
  kind: "ObjectId",
  value: ":id",
  path: "_id"
  }
  </code></pre>
  
  <p>The thing is though the same exact code works if it's modified for JSON so I don't know if its EJS or my Javascript.</p>
  
  <p>Thanks</p>