File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -56,3 +56,43 @@ Displays a visualization of the database.
56
56
``` bash
57
57
npm start -w web
58
58
```
59
+
60
+ # Cloud Functions
61
+
62
+ ## Development
63
+
64
+ ### TypeScript
65
+
66
+ ` ./cloud_functions ` stores the TypeScript Google Cloud Functions.
67
+
68
+ To add a new function:
69
+
70
+ 1 . Create a new file under ` ./cloud_functions/src ` .
71
+ > CRON jobs are generally prefixed with ` compute `
72
+ 2 . Register new function in ` ./cloud_functions/src/index.ts `
73
+
74
+ ``` ts
75
+ export const { newFunction } = require (' ./newFunction' );
76
+
77
+ functions .http (' newFunction' , newFunction );
78
+ ```
79
+
80
+ To run it locally:
81
+
82
+ <!-- TODO: Document this -->
83
+
84
+ 1 . Make sure to authenticate your GCP account.
85
+ 2 . Update the ` start ` script in ` ./cloud_functions/package.json `
86
+ ``` json
87
+ {
88
+ "scripts" : {
89
+ // other scripts
90
+ "start" : " npx functions-framework --target=newFunction [--signature-type=http]" ,
91
+ }
92
+ }
93
+ ```
94
+ 3 . To run the function locally, run in ` ./cloud_functions ` :
95
+
96
+ ```
97
+ npm run start
98
+ ```
You can’t perform that action at this time.
0 commit comments