Refactored Express server script by putting the CRUD routing methods and MongoDB integration into a new module called routes.js.