title: SyntaxError: UNexpected token n
body: <p>I'm learning how to use the MEAN stack and to practice I'm doing a web that ask you for your name, your email and a course you've done recently. Then it stores the information to a DB. I can't find the error and maybe is an easy one. </p>
  
  <pre><code>var express = require('express');
  var app = express();
  var bodyParser = require('body-parser');
  var morgan = require('morgan');
  var mongoose = require('mongoose');
  var port = process.env.PORT || 8080;
  var Schema = mongoose.Schema;
  var User = require('./user');
  
  app.use(bodyParser.urlencoded({ extended: true}));
  app.use(bodyParser.json());
  mongoose.connect('mongodb://localhost');
  
  app.use(morgan('dev'));
  
  var apiRouter = express.Router();
  apiRouter.route('/')
  .post(function(req, res) {
      var user = new User();
      user.name = req.body.name;
      user.course = req.body.course;
      user.mail = req.res.mail;
      user.save(function(err) {
          console.log(user.name);
          res.json({ message: 'Thank you!'});
      });
  }).get(function(req, res) {
      User.find(function(err, users) {
          if (err) res.send(err);
          res.json(users);
      });
      res.json({ message: 'YEAAAAHHHH!'});
  });
  
  app.use('/', apiRouter);
  
  app.listen(port);
  console.log('Magic happens on port' + port);
  </code></pre>
  
  <p>And this is the user.js:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var UserSchema = new Schema({
      name: {type: String, required: true},
      course: {type: String, required: true},
      mail: {type: String, required: true}
  });
  
  module.exports = mongoose.model('User', UserSchema);
  </code></pre>
  
  <p>Thank you! :D</p>
  
  <p>EDIT: sorry I forgot to put the error :</p>
  
  <pre><code>SyntaxError: Unexpected token n
  at parse (/Users/pingu/Documents/mean_project/node_modules/body-parser /lib/types/json.js:83:15)
  at /Users/pingu/Documents/mean_project/node_modules/body-parser/lib/read.js:116:18
  at invokeCallback (/Users/pingu/Documents/mean_project/node_modules/raw-body/index.js:262:16)
  at done (/Users/pingu/Documents/mean_project/node_modules/raw-body/index.js:251:7)
  at IncomingMessage.onEnd (/Users/pingu/Documents/mean_project/node_modules/raw-body/index.js:308:7)
  at emitNone (events.js:67:13)
  at IncomingMessage.emit (events.js:166:7)
  at endReadableNT (_stream_readable.js:905:12)
  at nextTickCallbackWith2Args (node.js:474:9)
  at process._tickCallback (node.js:388:17)
  </code></pre>