项目作者: NiFos

项目描述 :
GCP functions starter
高级语言: JavaScript
项目地址: git://github.com/NiFos/gcp-functions-starter.git
创建时间: 2020-10-24T07:17:19Z
项目社区:https://github.com/NiFos/gcp-functions-starter

开源协议:

下载



GCP functions starter


Starter for Google cloud functions

Example

In functions folder

How to start develop new functions?

  1. Clone repo.

  2. Create new folder in functions with name of new function.

  3. cd functions/NAME_OF_NEW_FUNCTION

  4. yarn init

  5. Now you must add typescript as dev dependency

    yarn add --dev typescript

    Create tsconfig.json with your settings

  6. In package.json add next:

    1. "config": {
    2. "name": "Name_of_function", // Name of function, will be used how as route: https://yourname.cloudfunctions.net/Name_of_function
    3. "mem": 256, // RAM
    4. "regions": [
    5. "europe-west1"
    6. ], // Regions to deploy
    7. "entryPoint": "name" // Name of exported function from index.ts
    8. },

How to set env?

On local machine you can create .env file and restart the server.

If you already deployed functions, you can setup environment variables in gcp console

How to start on local machine?

  1. yarn dev

How to deploy?

  1. yarn deploy