GithubHelp home page GithubHelp logo

rogiervandenberg / gcp-cloudfunction-go-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 23 KB

Boilerplate for writing Cloud Functions in Go on Google Cloud Platform

License: MIT License

Go 100.00%

gcp-cloudfunction-go-boilerplate's Introduction

GCP Cloud functions in Go Boilerplate

Boilerplate for writing Cloud Functions in Go on Google Cloud Platform. Based on https://github.com/GoogleCloudPlatform/functions-framework-go#functions-framework-for-go

Structure

Each folder in this project will have one function, as per Google instructions: "Where possible, we recommend splitting up large multi-function codebases and putting each function in its own top-level directory as shown above, with its own source and project configuration files. This approach minimizes the number of dependencies required for a particular function, which in turn reduces the amount of memory your function needs." https://cloud.google.com/functions/docs/writing#directory-structure-go

Each function will have its own cmd/main.go file, for local testing. When deploying, only the function as described in the init of the package will be used.

How to add your own function

  • Replicate the example folder, having a go.mod file and .go files for your functionality.
  • Run with possible cmd/main.go file: FUNCTION_TARGET=HelloWorld go run cmd/main.go
  • You could add the function to the .vscode/launch.json file for easy launching/devving

...Where HelloWorld is your own function name.

How to deploy your own function

From within the function directory:

gcloud functions deploy HelloWorld --runtime go116 --trigger-http

gcp-cloudfunction-go-boilerplate's People

Contributors

rogiervandenberg avatar

Watchers

 avatar

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.