Question: / / require works in here just like in server.js const bcrypt = require ( ' bcryptjs ' ) ; / / making a class

// require works in here just like in server.js
const bcrypt = require('bcryptjs');
// making a class to hold all our user logic
// in web development, this is called a "model"
class User {
// constructor gets called when a new object is made, just like C++, java, etc.
// taking in an assoc array of parameters ("properties") is nice here because
// it means we can pass in a row that we get from a database query
constructor(props){
// store the props in the new object
//(explicit "this" is a good practice)
this.id = props.id;
this.username = props.username;
this.password_hash = props.password_hash;
this.admin = props.admin;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!