I’m working with the Nodepad tutorial on DailyJS. I’ve forked it and am extending it to work for my own purposes. One issue I have with it is that the whole application is written in the app.js file, and I prefer to separate my application a bit more. How should I write mongo into my seperate Model files since everything mongoose related is in app.js.
What do I need to bring over to my external files so that they can properly connect to the database and understand my mongoose schemas?
Here is an example pulled directly from Gitpilot:
user.js:
Then in your other file…
Note: Some fields were removed from the
Usermodel for the sake of brevity. Hope this helps.