title: How to run a function when an Express server starts up?
body: <p>I can't seem to figure out how to get my express server to run a simple function when the server starts up. Where is the appropriate place to call a function to run on server startup, and the proper syntax?</p>
  
  <p>I have the function in my routes file as <code>exports.myFunction = function() { code here};</code></p>
  
  <p>I've tried sticking it in the app.configure block as routes.myFunction. I've tried changing it in routes to just be <code>myfunction() { code}</code>, then calling it in the configure block as <code>routes.myfunction()</code>, no luck there either. The function needs to stay in the file containing my routes since it alters some global variables there.</p>
  
  <p>I know it's some stupidly simple syntax thing, but I can't seem to find any hints <a href="http://expressjs.com/guide.html#configuration" rel="noreferrer">here</a> or on google. Much thanks for any help!</p>