Created
September 15, 2019 04:31
-
-
Save artemis15/940e3a6c28941b00cda80010600c1919 to your computer and use it in GitHub Desktop.
USer model fro REST API NODE Project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
let userSchema = new Schema( | |
{ | |
name : { | |
type:String, | |
required:[true,'Name is required'] | |
}, | |
email : { | |
type:String, | |
required:[true,'Email is required'] | |
} | |
}, | |
{ | |
timestamps:true | |
} | |
); | |
module.exports = mongoose.model("user", userSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment