Refactor server from coffeescript to js