I'm working through this Node ToDoList App API tutorial. It has one model, one controller and one routes file: https://www.codementor.io/olatundegaruba/nodejs-restful-apis-in-10-minutes-q0sgsfhbd
Repo: https://github.com/generalgmt/RESTfulAPITutorial
In the model, we use mongoose to define TaskSchema and export mongoose.model('Tasks', TaskSchema);
In the controller, we create a Task var, set equal to mongoose.model('Tasks', TaskSchema);
and use it to define several controller methods.
The server.js requires Task from the model, but never seems to use it for anything. The server also requires the routes file, which in turn require the controller, but I can'a see how they ever interact with the model.
How does the rest of the app know about the model? How does the controller know the schema for Task? Is this all mongoose magic?