change some server code to coffeescript