I've got a mean.js app I'm writing and I am conceptually confused about background processes.
I need to have some processes that run continuously in the background that operate on the mongodb database and do stuff like cleanup, email, tweets, etc.
I need a lot of the same functionality and libraries I have in my web app available to these background procs.
What is the best way to do this? Do I start with a brand new source base and treat these worker procs like a separate app? Or do I create, say, a daemon folder and fork the background procs when I start the server.js with grunt?
I think I am confusing myself and probably making this more complicated than it should be. I have looked at node daemon and child_processes and simple_daemon. But I'm not sure what path to take.
Thanks for your help.