Refactored server.js file, by splitting it into different modules