var mongoose = require('mongoose');
var User = require('../models/user');

var createUser = function(request, response) {
  if (!request.body.username || !request.body.password) {
    response.send({
      "message": "Provide a username and a password"
    });
  } else {
    User.create({
      username: request.body.username,
      password: request.body.password
    }, function(error, user) {
      if (error) {
        response.send({
          "message": "Encountered an error when crearting user"
        });
      } else {
        response.send({
          "message": "User created successfully"
        });
      }
    });
  }
};

module.exports = {
  createUser: createUser
}

@@ -135,24 +135,21 @@
 st.body.
-username
+email
  %7C%7C !req
@@ -217,25 +217,23 @@
 rovide a
- username
+n email
  and a p
@@ -284,24 +284,21 @@
 %7B%0A      
-username
+email
 : reques
@@ -308,16 +308,13 @@
 ody.
-username
+email
 ,%0A  

Fix an error in the users controller, where a username was required, but the model defines an email.