Start a new topic

Share code between custom endpoints


Is there a way to share code between different endpoints in order to avoid duplicating the code?

Yes, if you use the Business Logic CLI to manage your BL, you can upload common code to be used across endpoints and collection hooks.
Thanks for the prompt answer. I am facing another issue :

i am porting some client side code to a custom endpoint where i was linking a collection object to a user using :


return $'missions', mission, { exclude : ['owner'], relations : { owner : 'user' } });

on the custom end point i try to do this:

collectionAccess.collection('missions').save(mission, { exclude : ['owner'], relations : { owner : 'user' } });

but it was saving the entire user object inside the mission so i tried to do this:



But when i do the this, any query for the client side will not retrieve my mission based on the owner._id ...

Any idea on how to port the relation to a custom endpoint?
Try setting the "id" property to

Are you trying to resolve the reference on the client, or in the endpoint?
I m trying to set the reference in the endpoint
Right, but where are you trying to actually view/retrieve the reference?
i m trying to query the reference client side using :

var query = new $kinvey.Query();

query.equalTo('owner._id', user._id);

return $kinvey.DataStore.find('missions', query);

using, made it work ! Thanks and congrats for the awesome platform and the prompt support :)
Login or Signup to post a comment