refactoring of the server.js adding config files