fix bug to create rest.js
add some function to support creating query