Skip to content

Commit

Permalink
first debug version
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-zerui committed Sep 28, 2021
1 parent 78e6903 commit 4c64dba
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fg-http-nodejs/.s/localTriggerInfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"triggerId": "a82f0f1a7e584936a885b6fe325117f9",
"triggerTypeCode": "APIG",
"functionUrn": "urn:fss:cn-north-4:0bcc05efb100f2a92f53c011f262dfa0:function:default:fg-http-nodejs"
}
51 changes: 51 additions & 0 deletions fg-http-nodejs/s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
edition: 1.0.0 # 命令行YAML规范版本,遵循语义化版本(Semantic Versioning)规范
name: component-test # 项目名称
access: huawei
services:
component-test: # 服务名称
component: xinwuyun/fg
props:
projectId: 0bcc05efb100f2a92f53c011f262dfa0
region: cn-north-4
function:
functionName: fg-http-nodejs
handler: index.handler
memorySize: 128
timeout: 30
runtime: Node.js8.10
package: default
codeType: zip
code:
codeUri: ./src
trigger:
triggerTypeCode: APIG
eventTypeCode: APICreated
status: ACTIVE
eventData:
group_id: 51ed66ba137d43afaf24c8281114ff4a
env_name: Environment_rjmt
env_id: a36de477aa3c4388b7bce759b32e0d8a
auth: IAM
protocol: HTTPS
name: test
path: /fg-http-nodejss
match_mode: SWA
req_method: GET
backend_type: FUNCTION
type: 1
sl_domain: 51ed66ba137d43afaf24c8281114ff4a.apig.cn-north-4.huaweicloudapis.com

# interface APIGEventData {
# groupId: string;
# envId: string;
# auth: string;
# protocol: string;
# name: string;
# path: string;
# matchMode: string;
# reqMethod: string;
# backendType: string;
# type: number;
# slDomain: string;
# instanceId: string;
# }
Empty file added fg-http-nodejs/src/hello.js
Empty file.
19 changes: 19 additions & 0 deletions fg-http-nodejs/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const https = require('https');
let CONTEXT = null;
exports.handler = function (event, context, callback) {
CONTEXT = context;
console.log('OPTIONS request, pass.');
const result = {
body: 'Hello world, hello serverless.',
headers: {
"Content-Type":"application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type,Accept",
"Access-Control-Allow-Methods": "GET"
},
statusCode: 200,
isBase64Encoded: false
};
callback(null, result);
return;
}

0 comments on commit 4c64dba

Please sign in to comment.