GCP functions starter
Starter for Google cloud functions
Clone repo.
Create new folder in functions with name of new function.
cd functions/NAME_OF_NEW_FUNCTION
yarn init
Now you must add typescript as dev dependency
yarn add --dev typescript
Create tsconfig.json with your settings
In package.json add next:
"config": {
"name": "Name_of_function", // Name of function, will be used how as route: https://yourname.cloudfunctions.net/Name_of_function
"mem": 256, // RAM
"regions": [
"europe-west1"
], // Regions to deploy
"entryPoint": "name" // Name of exported function from index.ts
},
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
yarn dev
yarn deploy