I would not put that or any other application code into the server.js file. If I want code to run only once, then I put it into a model or controller and use a place that is only executed during server startup. For example look at https://github.com/FabianFrank/trainingMojito/blob/master/lesson1/myWeatherApp/mojits/Weather/controller.server.js and you will see that everything after line 5 and before line 19 would only be executed once during startup.