Git Product home page Git Product logo

google-cloud-functions-start's Introduction

google-cloud-functions-start

Pre installation

  • nvm

  • Node v6.9.1

    • why?

    • $ node --version
      v6.7.0
      $ npm install -g @google-cloud/functions-emulator
      $ functinos start
      Node.js v6.9.1 or greater is required to run the Emulator!
      $ nvm install v6.10.3
      $ npm install -g @google-cloud/functions-emulator
      $ functions start
      Warning: You're using Node.js v6.10.3 but Google Cloud Functions only supports v6.9.1.
      $ nvm install v6.9.1
      $ functions start
      $ functions stop
  • functions : Cloud Functions Local Emulator

Build

$ npm run build

> [email protected] build /Users/kanziw/dev/google-cloud-functions-start
> babel source.js -o index.js

Deploy to local

$ functions start
Starting Google Cloud Functions Emulator...
Google Cloud Functions Emulator STARTED
No functions deployed ¯\_()_/¯. Run functions deploy --help for how to deploy a function.
$ functions deploy testfunction --trigger-http
Copying file:///var/folders/mm/bv_d3ph101l98c6kssl0gx800000gn/T/us-central1-testfunction-21195fIi5mKwg2JJa.zip...
Waiting for operation to finish...done.
Deploying function......done.
Function testfunction deployed.
┌────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Property   │ Value                                                                                                  │
├────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Name       │ testfunction                                                                                           │
├────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Trigger    │ HTTP                                                                                                   │
├────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Resource   │ http://localhost:8010/kanziw/us-central1/testfunction                                                  │
├────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Timeout    │ 60 seconds                                                                                             │
├────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Local path │ /Users/kanziw/dev/google-cloud-functions-start                                                         │
├────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Archive    │ file:///var/folders/mm/bv_d3ph101l98c6kssl0gx800000gn/T/us-central1-testfunction-21195fIi5mKwg2JJa.zip │
└────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────┘
$ functions deploy testfunction2 --trigger-http
Copying file:///var/folders/mm/bv_d3ph101l98c6kssl0gx800000gn/T/us-central1-testfunction2-211985b89SErW7x4R.zip...
Waiting for operation to finish...done.
Deploying function......done.
Function testfunction2 deployed.
┌────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Property   │ Value                                                                                                   │
├────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Name       │ testfunction2                                                                                           │
├────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Trigger    │ HTTP                                                                                                    │
├────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Resource   │ http://localhost:8010/kanziw/us-central1/testfunction2                                                  │
├────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Timeout    │ 60 seconds                                                                                              │
├────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Local path │ /Users/kanziw/dev/google-cloud-functions-start                                                          │
├────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Archive    │ file:///var/folders/mm/bv_d3ph101l98c6kssl0gx800000gn/T/us-central1-testfunction2-211985b89SErW7x4R.zip │
└────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Testing

$ functions call testfunction
ExecutionId: f365dd81-18b3-4073-a45a-c6b076d0f927
Result: Success!
$ functions call testfunction2
ExecutionId: 9169d55c-e67a-41ac-8501-31ee39fa29dd
Result: [test2] Success!!!!!!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.