Moving the server logic out of the app.js