Members
movieSchema :mongoose.Schema
Movie Schema
Defines the structure of movie documents stored in the database.
Type:
- mongoose.Schema
(constant) port
Listens on the specified port (from environment variable or default).
userSchema :mongoose.Schema
User Schema
Defines the structure of user documents stored in the database.
Type:
- mongoose.Schema
Methods
generateJWTToken(user)
Generates a JWT token for a given user.
Parameters:
Name | Type | Description |
---|---|---|
user |
object | The user object to encode into the JWT. |
|
string | The generated JWT token. |
hashPassword(password) → {string}
Hashes a password before saving it to the database.
Parameters:
Name | Type | Description |
---|---|---|
password |
string | The paintext password to be hashed. |
Returns:
- The hashed password.
- Type
- string
validatePassword(password) → {boolean}
Compares a given password with the stored hash password.
Parameters:
Name | Type | Description |
---|---|---|
password |
string | The plaintext password to validate. |
Returns:
- Returns true if the password is valid, false otherwise.
- Type
- boolean