Hey Adnan. Thank you so much for taking the time to develop this example. How would you introduce another model to this solution? Set's say I wanted to add UsersModel. I've created the users.js within the models directory. the db.js you have only passes in one model ( const Models = { Note }) could that be an array of models? const Models = [Note, User, etc]? If so how does the handler.js know which model?
Last question, what would be the best way to associate those two tables? I've found many examples, but it would require a refactoring of the model's .js file.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey Adnan. Thank you so much for taking the time to develop this example. How would you introduce another model to this solution? Set's say I wanted to add UsersModel. I've created the users.js within the models directory. the db.js you have only passes in one model ( const Models = { Note }) could that be an array of models? const Models = [Note, User, etc]? If so how does the handler.js know which model?
Add another model to the object.
In db.js:
Once you want to require the models in the handler.js you can choose which one you want.
It's up to you to use what you like more. I personally think destructuring is freaking awesome. :)
What do you mean with destructuring?
Object destructuring
Thanks so much, I'll try the above. thanks again
Last question, what would be the best way to associate those two tables? I've found many examples, but it would require a refactoring of the model's .js file.