I have a form being submitted, but I am unable to assign assign the form 'req.body' username and password properties to the database (no hash on the password, just trying to get a MEAN CRUD app working for starters).

My form is as follows:

**form**

```
<form action="/signup" method="post">
    <input type="text" name="username" placeholder="Username" />
    <input type="password" name="password" placeholder="Password" />
    <button type="submit" value="Sign Up" />
</form>

```

**user schema (./models/user.js)**

```
var mongoose = require("mongoose");

var UserSchema = new mongoose.Schema({
    username: String,
    password: String
});

module.exports = mongoose.model('User', UserSchema);

```

**app.js (only showing reference to User model and "/signup" post function**

```
var User = require("./models/user");
app.post("/signup", function(req, res) {
    var user = new User();
    user.username = req.body.username;
    user.password = req.body.password;
    user.save(function(err) {
        if (err) {
            res.send(err);
        }
        res.redirect("/profile", { message: 'User successfully registered!', data: user });
    });
});

```

When I run the application:

```
node app.js

```

Everything runs fine. All endpoints, routes are working correctly.

However, when I click the submit button of the above form, I receive the following error in my Terminal:

```
TypeError: Cannot read property 'username' of undefined
    at Layer.handle [as handle_request](/node_modules/express/lib/router/layer.js:95:5)
    at next (/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)

```

How can I ensure that the **req.body.username** and the **req.body.password** successfully pass to the mongodb database?

Thanks for any help.