move chat.js into routes