refactoring server.js to modularize configuration.