How to add javascript code to google functions - google-cloud-endpoints

I want to write a google cloud function that will respond to POST requests. I want to write it in Javascript.
I've found Google's tutorial on how to do it, but at the beginning of the tutorial it says that this is a deprecated thing, and I have to do it using Cloud Endpoints Frameworks for App Engine. However, the link they provide doesn't help.
Any ideas on how to write a javascript google cloud function?
Link to the tutorial that I've found:
https://cloud.google.com/endpoints/docs/frameworks/legacy/v1/python/getstarted/clients/js/add_javascript
The warning that's displayed at the beginning of the tutorial:
Cloud Endpoints Frameworks v1 has been deprecated and will be shut
down on August 2, 2018. We recommend that you use the latest version
of this feature, which is renamed to Cloud Endpoints Frameworks for
App Engine. This new version supports App Engine standard environment,
provides lower latency, and has better integration with App Engine.
For more details, see Migrating to 2.0.
The migration link points to https://cloud.google.com/endpoints/docs/frameworks/legacy/v1/python/migrating

There are two completely different things you're talking about here.
Google Cloud Functions is a serverless way to write functions in Javascript which respond to HTTP requests.
Google Cloud Endpoints Frameworks for App Engine is a way to write App Engine applications in Python or Java which respond to HTTP requests.
The first link you provide is about writing browser-side JavaScript code which calls an Endpoints service. The corresponding link for the Endpoints 2.0 product is here.
Depending on what you actually want to do, you should consult one or more of these links.

Related

Firebase Cloud Firestore "Request/response" documentation

Most of "bigger" project I was working with was using REST API for Frontend->Backend communication. I was using Firebase Cloud Firestore for some small (one-day/hackathon) projects. Now I'm thinking about using Firestore for some bigger project but I'm not sure if this will work.
For "standard", REST api project I had Swagger documentation, where each developer could see list of all endpoints with request/response data structures. How does it work with Firestore? Can I create similar documentation for developers to check data structure, so they will know what can they add and what should they read? Or maybe there is another way?
I'm thinking, maybe there is no tool for this kind of documentation because frontend data structures are defining database structure? But what if I am connecting database from two or more platform (ex. web, mobile and cloud functions)? How can I synchronize knowledge about data structures between all the developers?
I was looking for some answers but couldn't find anything useful expect advice to manually maintain some documentation. How does it work in your projects? Is there some automation? Manually written documentation? Or no documentation - everything "in code"?
I understand your concerns, but unfortunately, there is no such tool available for Cloud Firestore to generate the documentation for database structure as Swagger.
I believe you can do it programatically.
From
Generating Swagger Docs in Firebase Cloud Functions project
I'm using express and nodejs in my Firebase Function implementations, and for me, Swagger doc generation can be implemented via the following libraries:.
https://github.com/scottie1984/swagger-ui-express
https://github.com/Surnet/swagger-jsdoc
You can find other libraries at:
https://swagger.io/tools/open-source/open-source-integrations
In addition to the responses there, the following service allows you to access Firestore metadata, click the explorer tab, looks promising for your use case https://aapi.io/api-directory/Google_CloudFirestore_GoogleCloudFirestoreAPI_v1beta1 though not necessarily more so than the links above.

How to get access to the API testing console from the Azure cognitive services desktop?

I'd like to get access to the API Testing console (the one mentioned in the Quick start of the Cognitive services translation services, useful to test the API without writing a single line of code), but I don't find any direct access to on the Microsoft Azure. Thanks in advance for your help.
I think the text you mention about the console is a copy-paste error from other cognitive services quick start page.
Generally with Cognitive Services, you can find webpages which seems to be hosted under Azure API Management, where you got the basic documentation and access to a testing Console. For example for West Europe, all the services are here: https://westeurope.dev.cognitive.microsoft.com/docs/services/
And for Anomaly Detector API, you can see the link to the testing console:
Sadly, it seems that there is not equivalent for Translator API.
You still have samples on Github that you can use, in several dev languages: https://github.com/MicrosoftTranslator
Or you can directly call the API with a tool like Postman, it is really easy to implement

Google API Explorer deprecated for Endpoints APIs?

I have a REST API published to Google Endpoints and have been using the API Explorer to interact with it. When I accessed API Explorer this week I found this notice:
"This site is deprecated for Endpoints APIs. For exploring and testing Endpoints APIs, try the Cloud Endpoints Portal."
I can't find any other information such as when this service will be terminated. Anybody have a link or other information?
The APIs Explorer not going away so much as moving to Cloud Endpoints Portals. You still get an APIs Explorer there with all the same features, and more. It's just a newer format more specific to your API, with more detail and better navigation.
As mentioned on that page, you can try out the demo, including trying out your own API spec using the "Try your own API!" button.

Do I still need a backend like RoR or Django if I use Firebase?

I am a Front-end developer with limited backend knowledge.
My question is do I need other backend frameworks like Django or Ruby on Rails if I use Firebase as a backend? In other words, can I solely depend on Firebase as a backend and build a single page web application or Mobile application without writing a single line of backend code?
Thanks for your time viewing the question.
I was also looking for a platform to minimize server code and I found that firebase can help a lot.
You will get plenty of docs on net. You can start at angular fire + firebase doc
https://www.firebase.com/docs/web/libraries/angular/quickstart.html
Following document was helpful for me to design my app, which requires some amount of off-line processing too.
https://firebase.googleblog.com/2013/03/where-does-firebase-fit-in-your-app.html

Do I have to pay for Google Endpoints?

I'm thinking of using the Google Endpoint service to add some simple features on my Android app. Following a tutorial on Github (https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloWorld) I managed to create a very simple servlet with basic code and that's all I need. But it's not clear if I'll have to pay at some point (30 days free trial?) or if I only have to pay to access to the whole platform.. Is a simple servlet on Google Endpoints completely free without restrictions?
It depends on where you are hosting your servlet. If it e.g. meets the constraints for Google App Engine's free quota you won't have to pay (as far as I know). I am in fact running such an application since quite a while now.

Resources