googleapis-nodejs-functions
Version:
Google Cloud Functions Client Library for Node.js (unofficial)
86 lines (56 loc) • 1.82 kB
Markdown
**Table of contents:**
* [Quickstart](
* [Before you begin](
* [Installing the client library](
* [Using the client library](
* [Samples](
* [Versioning](
* [Contributing](
* [License](
1. Select or create a Cloud Platform project.
[][projects]
1. Enable billing for your project.
[][billing]
1. Enable the Google Cloud Functions.
[][enable_api]
1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.
[]: https://console.cloud.google.com/project
[]: https://support.google.com/cloud/answer/6293499#enable-billing
[]: https://console.cloud.google.com/flows/enableapi?apiid=cloudfunctions.googleapis.com
[]: https://cloud.google.com/docs/authentication/getting-started
npm install --save googleapis-nodejs-functions
```javascript
// Imports the Google Cloud client library
const { GCF } = require('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
.getCloudFunctions()
.then(data => {
const fns = data[0];
//console.log('FUNCTIONS: ', fns);
const fn = fns[0];
console.log(fn.metadata);
})
.catch(err => {
console.error('ERROR:', err);
});
```
Apache Version 2.0
See [LICENSE](LICENSE)