This repository is containing all the Cloud Functions
we used in the CHAT APP sample, you should include them into your project on AGC Console
in order to let the app working well.
About HUAWEI Cloud Functions
- A computer running a text editor or IDE for JS development
- Node.js v10.12.0 or later
-
each project contains a folder named
resource
, you need to upload your credentials file into it; -
edit the constant
credentialPath
into eachCloudDBZoneWrapper
file with the real value; -
build each project with
node
runningnpm install
and thennpm run build
; -
archive all the files into a zip file named
handler.zip
like the following structure:handler.zip
|---- handler.js
|---- node_modules
|---- resource
|---- model
|----...;
-
create a new
Cloud Function
onAGC Console
following this guide; -
into the 'CODE' section upload the zip file
handler.zip
; -
follow the specific
SETUP
below for eachCloud Function
.
As TRIGGER
add an AUTH TRIGGER
with userLogin
as EventType
As TRIGGER
add an AUTH TRIGGER
with userLogout
as EventType
As TRIGGER
add a CLOUD DB TRIGGER
with the following parameters:
- EventSourceId - box 1 (DB Zone): ChatDemo (as default or your own DB Zone), box 2: input_messages
- EventType - onUpsert;
- Enabled - true
As TRIGGER
add a CLOUD DB TRIGGER
with the following parameters:
- EventSourceId - box 1 (DB Zone): ChatDemo (as default or your own DB Zone), box 2: poll_lunch
- EventType - onUpsert;
- Enabled - true
As TRIGGER
add a CRON TRIGGER
with the following parameters:
- Schedule - follow the syntax based on your requirement
- Transfer - async