title: Cannot POST form node.js - express
body: <p>Using express 3.1.0 I have a super simple form:</p>
  
  <pre><code>&lt;form action="/signup" method="post"&gt;
      &lt;div&gt;
          &lt;label&gt;Username:&lt;/label&gt;
          &lt;input type="text" name="username"/&gt;&lt;br/&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;label&gt;Password:&lt;/label&gt;
          &lt;input type="password" name="password"/&gt;
      &lt;/div&gt;
      &lt;div&gt;&lt;input type="submit" value="Sign Up"/&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and in the app.js:</p>
  
  <pre><code>/**
   * Module dependencies.
   */
  
  var express = require('express')
    , routes = require('./routes')
    , fs = require('fs')
    , User = require('./models/User.js')
    , user = require('./routes/user')
    , http = require('http')
    , path = require('path');
  
  var app = express();
  
  app.configure(function(){
    app.set('port', process.env.PORT || 3000);
    app.set('views', __dirname + '/views');
    app.set('view engine', 'jade');
    app.use(express.favicon());
    app.use(express.logger('dev'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(app.router);
    app.use(express.static(path.join(__dirname, 'public')));
  });
  
  app.configure('development', function(){
    app.use(express.errorHandler());
  });
  
  app.get('/', routes.index);
  app.get('/form', function(req, res) {
      fs.readFile('./form.html', function(error, content) {
          if (error) {
              res.writeHead(500);
              res.end();
          }
          else {
              res.writeHead(200, { 'Content-Type': 'text/html' });
              res.end(content, 'utf-8');
          }
      });
  });
  
  app.post('/signup', function(req, res) {
  
      var username = req.body.username;
      var password = req.body.password;
      User.addUser(username, password, function(err, user) {
          if (err) throw err;
          res.redirect('/form');
      });
  });
  
  app.get('/users', user.list);
  
  
  http.createServer(app).listen(app.get('port'), function(){
    console.log("Express server listening on port " + app.get('port'));
  });
  </code></pre>
  
  <p>when trying to post this form i'm getting:</p>
  
  <pre><code>Cannot POST /signup
  </code></pre>
  
  <p>and in the console:</p>
  
  <pre><code>"NetworkError: 404 Not Found - http://localhost:3000/signup"
  </code></pre>
  
  <p>what am i missing here?</p>