Getting a validation error in mongoose even though files are provided

Try this code below and let me know if the same error will appear

app.post('/saveappointment', function(req, res) {

  var appointment = new Appointment({
    //need to add an email here 
    name: req.body.name,
    phone: req.body.phone,
    address: req.body.address,
    start: req.body.appointment.start,
    end: req.body.appointment.end,
    details: req.body.details,
    address: req.body.address
  });


  appointment.save(function(err, resp) {
    if (err) {
      console.log(err);
      res.send({
        message: 'something went wrong'
      });
    } else {
      res.send({
        message: 'the appointment has been saved'
      });
    }

  });
});

You need to install ( npm install body-parser --save), and use it in your express server as below (app.js). hope this answer help someone :)

var express = require('express')
var bodyParser = require('body-parser')
var app = express()

app.use(bodyParser.json())

app.use('/api',api)
module.exports = app