Open QuXiangjie opened 7 months ago
Create user model
in the api-create a models folder inside the model folder, create -user.model.js inside this file
import mongoose from 'mongoose' const userSchema=new mongoose.Schema( { username:{ type: String, required: true, unique: true, }, email:{ type: String, required: true, unique: true, }, password:{ type: String, required: true, unique: false, ---two customers can have the same password }, } ,{timestamps:true}); const User=mongoose.model('User',userSchema) export default User
Create user model
in the api-create a models folder inside the model folder, create -user.model.js inside this file