finished. chat not working for some reason thought.
moved code to server.js from index.js