This recipe shows you how to write and query entity in Cloud Datastore from a Cloud Function.
-
Follow the [Cloud Functions quickstart guide][quickstart] to setup Cloud Functions for your project.
-
Clone this repository:
git clone https://github.com/doitintl/cloud-function-datastore.git cd nodejs-docs-samples/functions/cloud-function-datastore
-
Ensure the Cloud Datastore API is enabled:
Click here to enable the Cloud Datastore API
-
Deploy the "get" function with an HTTP trigger:
gcloud functions deploy datastoreQuery --runtime nodejs8 --trigger-http
-
Get the function url
gcloud functions describe datastoreQuery
-
Call the function
curl "https://[YOUR_REGION]-[YOUR_PROJECT_ID].cloudfunctions.net/get"