Support Topics Documentation Slack YouTube Blog

Missions Serverless 101 Task1 how does code work internally

Just to clarify, in future we’re supposed to compose controller.js file ourselves, right? I mean Backendless provides service code, but the developer must then revoke functions provided himself.
So, it’s important to understand the logic behind controller.js?
This code:

this.CodelessShoppingCartService

what does “this” mean? Is it an App instance? If so, then the service is an object inside the App(I saw the object of service is created as an object)?

Then we use promises. How do we know what is returned as an argument inside function and if there’s actually returned something?

Oh, and also, about the client code, is it safe to expose all scripts like that? Is there an article to secure API calls with the role and permissions configuring practices?
Thanks.

About this, please see this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this

Yes, the service is an object inside of the app.

Regarding this question:

When you develop a service, you know what’s returned. Then when you consume that service, you know what to expect.

Regarding the security question, please see this: https://backendless.com/docs/js/data_security.html

Also, it will be very helpful, bot for you and us if there is a separate support topic for each individual
question.

Regards,
Mark

1 Like

When you develop a service, you know what’s returned. Then when you consume that service, you know what to expect.

oh, that is an idea :smiley:

Also, it will be very helpful, bot for you and us if there is a separate support topic for each individual
question.

are you sure? Those are exact questions that occur during the exact Mission step, so even for myself in future (I know how my brain works - it tends to forget, but remember where it was seen) - I always return to the reference and never to the particular question.

Besides those are very basic questions and refer also to a specific task which never occurs outside the scope of the task.

And it’s connected, my brain sees it as 1 question, as 1 issue, it doesn’t separate, so I can do this only a few days later and that’s not very cool.

“API service invocation” is a general task that is common in the majority applications we see being built with Backendless. The fact that a specific Mission/Task focuses on that functionality, doesn’t mean that it is the only time you’d ever use that feature. (which is true pretty much for every single task in the Missions system :wink: ).

Cheers,
Mark

1 Like