Table of contents:
-
Select or create a Cloud Platform project.
-
Enable billing for your project.
-
Enable the Google Cloud Functions.
-
Set up authentication with a service account so you can access the API from your local workstation.
npm install --save vizzuality/googleapis-nodejs-functions
// Imports the Google Cloud client library
const { GCF } = require('../build/src'); // @TODO vizzuality/googleapis-nodejs-functions
// Your Google Cloud Platform project ID
const projectId = 'YOUR_PROJECT_ID';
// Creates a client
const gcf = new GCF({
keyFilename: './credentials.json',
projectId
});
// Get Functions and metadata
gcf
.getFunctions()
.then(data => {
const fns = data[0];
//console.log('FUNCTIONS: ', fns);
const fn = fns[0];
fn.getMetadata()
.then(data => {
console.log('Function: ', data[0]);
})
.catch(err => {
console.error('ERROR:', err);
});
})
.catch(err => {
console.error('ERROR:', err);
});
Apache Version 2.0
See LICENSE