File tree Expand file tree Collapse file tree 4 files changed +83
-0
lines changed Expand file tree Collapse file tree 4 files changed +83
-0
lines changed Original file line number Diff line number Diff line change
1
+ # package directories
2
+ node_modules
3
+
4
+ # Serverless directories
5
+ .serverless
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " fg-nodejs" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " Huawei Serverless Cloud Function example using Nodejs" ,
5
+ "main" : " src/index.js" ,
6
+ "scripts" : {
7
+ "test" : " echo \" Error: no test specified\" && exit 1"
8
+ },
9
+ "author" : " cloud.tencent.com" ,
10
+ "license" : " MIT" ,
11
+ "dependencies" : {
12
+ "serverless-huawei-functions" : " *"
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ # Welcome to Serverless!
2
+ #
3
+ # This file is the main config file for your service.
4
+ # It's very minimal at this point and uses default values.
5
+ # You can always add more config options for more control.
6
+ # We've included some commented out config examples here.
7
+ # Just uncomment any of them to get that config option.
8
+ #
9
+ # For full config options, check out the Huawei Cloud Function Compute
10
+ # plugin docs:
11
+ # https://github.com/zy-linn/serverless-huawei-functions
12
+ #
13
+ # For documentation on Huawei Cloud Function Compute itself:
14
+ # https://www.huaweicloud.com/product/functiongraph.html
15
+
16
+ # Update the service name below with your own service name
17
+
18
+ service : fg-service # service name
19
+
20
+ frameworkVersion : " 3"
21
+
22
+ provider : # provider information
23
+ name : huawei
24
+ credentials : ~/.fg/credentials # 绝对地址,默认为 ~/credentials
25
+ runtime : Node.js14.18 # 可以指定华为云支持的Runtime, 默认Node.js14.18
26
+ # you can overwrite defaults here
27
+ # stage: dev # 阶段,默认为 dev
28
+ # package: default
29
+ # memorySize: 256 # 默认256M,优先级:函数设置>默认设置
30
+ # timeout: 30 # 默认30s,优先级:函数设置>默认设置
31
+ # region: cn-north-4 # 默认cn-north-4,优先级:函数设置>默认设置
32
+ # environment: # 环境变量,可选
33
+ # variables:
34
+ # ENV_FIRST: env1
35
+ # ENV_SECOND: env2
36
+
37
+ plugins :
38
+ - serverless-huawei-functions
39
+
40
+ functions :
41
+ hello_world :
42
+ handler : index.handler
43
+ # you can overwrite config here
44
+ # description: Huawei Serverless Cloud Function
45
+ # package: default
46
+ # memorySize: 256
47
+ # timeout: 30
48
+ # environment:
49
+ # variables:
50
+ # ENV_FIRST: env1
51
+ # ENV_SECOND: env2
Original file line number Diff line number Diff line change
1
+ exports . handler = async ( event , context ) => {
2
+ const output =
3
+ {
4
+ 'statusCode' : 200 ,
5
+ 'headers' :
6
+ {
7
+ 'Content-Type' : 'application/json'
8
+ } ,
9
+ 'isBase64Encoded' : false ,
10
+ 'body' : JSON . stringify ( event ) ,
11
+ }
12
+ return output ;
13
+ }
You can’t perform that action at this time.
0 commit comments