title: Where do I save functions that are called with a setTimeout?
body: <p>I'm learning NodeJS and am trying to stick with the MVC architecture.  I'm getting stuck on where to place those functions that update data from an outside source on a set loop, with a 30 second or so delay.</p>
  
  <p><strong>Example:</strong> I build an app that takes data from a API, <code>Orders</code> in this case, and stores it in a database.  I can add orders to my database locally, and I want the orders database to be synchronized with the outside source mentioned previously, every 30 seconds.</p>
  
  <p>My models directory will contain <code>Order.js</code> which includes an order schema and it will connect to MongoDB via Mongoose. My controller will have API endpoints for CRUD operations.</p>
  
  <p>Where does the function go that refreshes the data from the server?  In the controller?  Then I would export that function so that I can set up the loop that updates the database in my <code>app.js</code> (or whatever I use to start the application)?</p>