title: How to submit a successful post request using the MEAN stack?
body: <p>I'm using yeoman to scaffold a project.  In the end I want to learn to scaffold the CRUD.  I'm getting stuck on a post request.  I've picked the <a href="https://github.com/DaftMonk/fullstack-demo" rel="nofollow noreferrer">angular-fullstack generator</a> because I'm very comfortable with normal angular-generator. </p>
  
  <p>My post request attempts are being hulled by a 400 error while trying to submit a new object to the Things collection. I'm pretty lost, I need to see completed code of a post request using this folder structure. </p>
  
  <p><strong>UPDATE:</strong>
  The 400 error is gone however, the req.body.  </p>
  
  <p><strong>UPDATE2:</strong>
  Everything is properly working now  answers are both in my code and answer.  </p>
  
  <p>So, <strong>Using the angular-fullstack generator of yeoman, how would I make a post request to create an awesomeThing in the Thing collection of the mongo db.</strong>  </p>
  
  <p>I'm surely missing something but I think most of the pieces needed to make a POST request successful are presented below. Any direction would be much appreciated.</p>
  
  <p><strong>app/views/partials/main.html</strong></p>
  
  <pre><code>&lt;div class="row marketing"&gt;
    &lt;div ng-repeat="thing in awesomeThings"&gt;
        &lt;h4&gt;{{thing.name}}&lt;/h4&gt;
        &lt;p&gt;{{thing.info}}&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;    
  &lt;form ng-submit="addAwesome()"&gt;
          &lt;input type="text" ng-model="tempAwesome.name"&gt;
          &lt;input type="submit" class="btn btn-primary" value="Add"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>app/scripts/controllers/main.html</strong></p>
  
  <pre><code>$scope.name = [];
  $http.get('/api/awesomeThings').success(function(awesomeThings) {
        $scope.awesomeThings = awesomeThings;
      });
  $scope.addAwesome = function() {
        $http.post('/api/awesomeThings', $scope.tempAwesome).success(function(postData) {
          $scope.awesomeThings = postData;
  
        }).error(function(postData, status){
            console.log(postData);
            $scope.status = status;
            console.log(status);
        });
  
      };
  </code></pre>
  
  <p><strong>lib/routes.js</strong></p>
  
  <pre><code>  app.route('/api/awesomeThings')
      .get(api.awesomeThings)
      .post(api.create);
  </code></pre>
  
  <p><strong>lib/controllers/api.js</strong></p>
  
  <pre><code>mongoose.model('Thing', ThingSchema);
  
    exports.create = function (req, res) {
  
    var awesomeThing = new Thing(req.body);
    awesomeThing.save(function(err) {
       if (err) return res.json(400, err);
     });
    };
  </code></pre>
  
  <p><strong>lib/models/thing.js</strong></p>
  
  <pre><code>var ThingSchema = new Schema({
    name: String,
    info: String,
    awesomeness: Number
  });
  </code></pre>
  
  <p>I have a hunch it is mongoose blocking this because my submission isnt matching the schema? ?  any other thoughts?
  <img src="https://i.stack.imgur.com/rASkW.png" alt="enter image description here"></p>