Reputation: 14864
Normally my endpoints have an android/iOS client. I am now trying to work with a javascript client. Looking at the provided git example, I see a number of namespace stuff (lines 9-19). Why are those important? Say my api exists at my-endpoints.appspot.com
, do I have to do the namespace thing? How?
Also does anyone have a more comprehensive example they don't mind sharing? Something that more fully exercises the full client api https://developers.google.com/api-client-library/javascript/reference/referencedocs
Upvotes: 0
Views: 38
Reputation: 83153
A good example is Romin Irani's tutorials: https://rominirani.com/google-cloud-endpoints-tutorial-part-4-37ea3aac7948
Note however that Google recently advised to use the promise mode of the Google API Client Library for JavaScript. See https://developers.google.com/api-client-library/javascript/features/promises#using-promises and How to call App Engine Endpoints with the JavaScript library in promises mode
Upvotes: 0
Reputation: 3250
The 'namespace thing' is not necessary. You should be free write in the style that you like by loading your code as they do in the example and making a no-argument initialiser that calls your code, which is passed to the API client here. It seems that a gapi
global is initialised after the google api client is loaded but before your code is run. This allows your endpoint to be accessed.
Upvotes: 1