WIP: fixed some issues in server.js and note: https://gist.github.com/yhagio/0e29815cd1e1f086242e