I am trying to save a user to mongodb database using post request as follow, but I got the error TypeError: User is not a function. It\'s a pretty simple set up
// models/user.js
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var UserSchema = new Schema({
email: {
type: String,
unique: true,
lowercase: true
},
password: String
});
var User = mongoose.model('User', UserSchema)
module.exports = { User } <-- capital 'U'