refactor restify.js