Refactoring routes

Further refactoring of `server.js`