Refactor the Server.js