title: Express cannot PUT/DELETE method. What is going wrong?
body: <p>Ok So I have a simple node.js / express.js / mongodb app set up here with my config as follows.
  </p>
  
  <pre><code>var express = require('express'),
      mongoose = require('mongoose');
      http = require('http');
  
  var app = express();
  
      app.configure(function(){
      app.set('port', process.env.PORT || 3000);
      app.set('views', __dirname + '/views');
      app.set('view engine', 'jade');
  
      //middleware stack
      app.use(express.bodyParser());
      app.use(express.methodOverride());
      app.use(app.router);
      app.use(express.static(__dirname + "/public"));
  });
  
  mongoose.connect("mongodb://localhost/hello");
  </code></pre>
  
  <p>The problem lies when I try to make PUT or DELETE requests. My form is this simple</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form method="POST" action="/users/#{user.name}"&gt;
      &lt;input type="hidden" name="_method" value="PUT"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Now my router catches the route with the express .put() method </p>
  
  <pre class="lang-js prettyprint-override"><code>app.put('/users/:name', function(req, res) {
  
      var b = req.body;
  
      Users.update(
          { name: req.user.name },
          { name: b.name, age: b.age, email: b.email },
          function(err) {
              res.redirect('/users/'+b.name);
          });
  })
  </code></pre>
  
  <p>When I make the request I simply get a "Cannot PUT" or "Cannot DELETE" error.</p>
  
  <p>I have tried to make this same request via chomes RESTful client with the same result.</p>
  
  <p>I have read a topic witch has the same problem as me although following the comments the answers did not solve my problem.</p>
  
  <p>Questions I have looked into
  <a href="https://stackoverflow.com/questions/9859287/expressjs-support-for-method-delete-and-put-without-the-methodoverride">expressjs support for method delete and put without the methodoverride</a></p>
  
  <p><a href="https://stackoverflow.com/questions/165779/are-the-put-delete-head-etc-methods-available-in-most-web-browsers">Are the PUT, DELETE, HEAD, etc methods available in most web browsers?</a></p>
  
  <p>Along with a few others.
  I have also referenced the express.js and mongo documentation several times.
  I just cant think what could be going wrong.</p>
  
  <p>Any help is appreciated.</p>