Cloud Code vs Client Side Code

I am currently trying to migrate an Ionic 1 application using Parse Server from Ionic 1/AngularJs to Ionic 3/Angular 4.

The app is quite similar with Instagram structure as concern the newsfeed, the comments, the likes.

So I would like to know if it is more efficient to write the queries with Cloud Code on Server or just put them normally on Client Side in the Controllers.

Thank you a lot

I’m not sure efficiency is necessarily the most important concern here. I would consider security more important, but either way, I recommend doing absolutely as much as possible on the server.

1 Like

thank you a lot. I had started writing the queries on my controllers.Your answer will save me a lot of time. Do you have any good tutorial how a query on my contoller would be written on Parse Cloud code and how user will consume it?

Thank you very much

Sorry, I don’t know what “Parse Cloud” is. I write my application servers using gocraft/web and PostgreSQL. The fundamental design principles common to pretty much all programs at this level these days is called REST, and there are a zillion resources on the web that give suggestions. I don’t have a particular favorite to point you to.

Thank you

I am using Parse Server, a very powerful BaaS, so that`s why i mentioned Parse Cloud Clode.

I am new at this one because I was writing only on Client Side, and now I don`t know how to consume Cloud Code.

Now i have in my service this code to make the query

initializeItems() {
     this.users= this.localdata.tmpusers;
  constructor(public navCtrl: NavController, private localdata: localData) {
      this.searchControl = new FormControl;
      this.query.find().then(data => {
      this.tmp = data; 
      this.users = this.localdata.tmpusers;
      console.log (this.users);

and I have a provider for localstorage like this:

setUsers (users){
        window.localStorage.users_data = JSON.stringify(users);
       return JSON.parse(window.localStorage.users_data || '[]');

    tmpusers = this.getUsers();
        this.tmpusers.sort(function(a, b) {
            var nameA = a.username.toUpperCase(); // ignore upper and lowercase
            var nameB = b.username.toUpperCase(); // ignore upper and lowercase
            if (nameA < nameB) {
              return -1;
            if (nameA > nameB) {
              return 1;
            // names must be equal
            return 0;

So I don`t know how to proceed. The concept is to write the query in the Cloud Code AND the localstorage provider?Or just the query to consume it from client side?

Thank you a lot

(Linking to things people may not know about is usually very helpful. That way they don’t have to google for random product names but know what you actually talk about)

you are right, maybe it is better open a new topic about this more specific