node-express-mongodb-jwt-rest-api-skeleton
Version:
Node.js express.js MongoDB JWT REST API - This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API)
47 lines (45 loc) • 833 B
JavaScript
const mongoose = require('mongoose')
const validator = require('validator')
const ForgotPasswordSchema = new mongoose.Schema(
{
email: {
type: String,
validate: {
validator: validator.isEmail,
message: 'EMAIL_IS_NOT_VALID'
},
lowercase: true,
required: true
},
verification: {
type: String
},
used: {
type: Boolean,
default: false
},
ipRequest: {
type: String
},
browserRequest: {
type: String
},
countryRequest: {
type: String
},
ipChanged: {
type: String
},
browserChanged: {
type: String
},
countryChanged: {
type: String
}
},
{
versionKey: false,
timestamps: true
}
)
module.exports = mongoose.model('ForgotPassword', ForgotPasswordSchema)