Update rest.js

Add the support of amd and cmd module