Moved all server code out of server and into a single server.js file