i'm using apiclusterjs
, below endpoints, want have user
configurable.
http://www.example.com/api/user/list
http://www.example.com/api/user/add/{id}
http://www.example.com/api/user/remove/{id}
http://www.example.com/api/user/update/{id}
problem can solved in apiclusterjs
.
configuration part
apicluster .defaults({ name: 'mydefault', config: { 'user': 'api/user' }, endpoints: { "userlist": "_user_/list", "adduser": "_user_/add/:userid", "removeuser": "_user_/remove/:userid", "updateuser": "_user_/update/:userid" } });
return user list endpoint url.
var userlisturl = apicluster.get('userlist').url(); document.write( adduserurl );
return add user endpoint url.
var adduserurl = apicluster .get('adduser') .arg({ 'userid': 342543 }) .url(); document.write( adduserurl );
Comments
Post a Comment