项目作者: therynamo

项目描述 :
A playground for creating functions for Google Cloud Functions
高级语言: JavaScript
项目地址: git://github.com/therynamo/test-functions.git
创建时间: 2017-03-18T18:41:33Z
项目社区:https://github.com/therynamo/test-functions

开源协议:

下载


test-functions

A set of functions for testing out Google Cloud Functions.

Building

npm run build will zip up the directory. Once you’ve run that command you can upload the zip to a GCS bucket however you’d like (Using the upload zip option in GCF is a quick way to do it).

Deploying

When creating a GCF, import the zip folder from your storage bucket (or upload). Then, in the Function to execute input field, place one of the methods exported in the main index.js file.

Credentials

Store credentials in .creds.js in an object. It will get zipped up with the rest of the project and ignored in source control.

  1. module.exports = {
  2. twilioPhoneNumber: "<Phone>",
  3. twilioAccountSid: "<SID>",
  4. twilioAuthToken: "<AuthToken>"
  5. }

Testing

You can use the functions-emulator to run any of the functions locally prior to deploying your function. Basic functionality of the emulator is included in the npm scripts so you don’t have to install it globally.

1) npm start, to start up the emulator
2) npm run deploy -- <functionName> --<flags>, to deploy your function locally
3) npm run call -- <functionName>, to call your method
4) npm run logs, to get logs from your function
5) npm run stop, stops GCF emulator

Debugging

1) npm run inspect --<functionName>, to run your function in debug mode
2) npm run logs to get chrome debug url

Debugging functions emulator with Chrome DevTools