refactored server.js
refactored server code, created controller and schema file