I am creating a node API connecting to a mySql db using Sequelize. I want users of the API to be able to specify which models to include in the results of a query. For example I have a model like this:
Student.init({
userID: DataTypes.INTEGER,
name: DataTypes.STRING,
gradeID: DataTypes.INTEGER
}
I want the user to be able to specify if they want to include the full User and/or Grade objects when querying Students like this:
http://localhost/api/students?include=Grade,User
How would I go about doing this within the controller using Sequelize?