Full-Stack Web Development with Vue.js and Node

(singke) #1
Building the Real Application Chapter 5

user_id: String,
rate: Number
})

const Rating = mongoose.model("Rating", RatingSchema)
module.exports = Rating

Include the same model in movies.js as well:


const Movie = require("../models/Movie");
const Rating = require("../models/Rating");

That's it! Now a user should be able to rate a movie when logged-in. The user should get a


popup when Rate this movie is clicked and display the rated score upon successful rating


with a thank you message:

Free download pdf