forked from alibaba/funcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix bug] nodejs12 runtime support (alibaba#931)
* Add nodejs12 to templates * Amend nodejs12 to error message * Amend nodejs12 to docker runtime image map * Amend nodejs12 to specification * Amend nodejs12 to debug runtime case * Amend nodejs12 to debug runtime test case * Amend nodejs12 to sbox tips runtime case * Amend nodejs12 to supported runtime * Amend nodejs12 to ros runtime enum * Amend nodejs12 to runtime ignore dependencies case * Amend nodejs12 to validate runtime schemas
- Loading branch information
1 parent
11900a1
commit 8a74d66
Showing
21 changed files
with
180 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "event-nodejs12", | ||
"description": "Print hello world", | ||
"vars": { | ||
"service": "{{ projectName }}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.env | ||
package-lock.json | ||
template.yml | ||
.funignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
if you open the initializer feature, please implement the initializer function, as below: | ||
module.exports.initializer = function(context, callback) { | ||
console.log('initializing'); | ||
callback(null, ''); | ||
}; | ||
*/ | ||
|
||
module.exports.handler = function(event, context, callback) { | ||
console.log('hello world'); | ||
callback(null, 'hello world'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ROSTemplateFormatVersion: '2015-09-01' | ||
Transform: 'Aliyun::Serverless-2018-04-03' | ||
Resources: | ||
{{ service }}: | ||
Type: 'Aliyun::Serverless::Service' | ||
Properties: | ||
Description: 'helloworld' | ||
{{ projectName }}: | ||
Type: 'Aliyun::Serverless::Function' | ||
Properties: | ||
Handler: index.handler | ||
Runtime: nodejs12 | ||
CodeUri: './' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "http-trigger-nodejs12", | ||
"description": "Print hello world", | ||
"vars": { | ||
"service": "{{ projectName }}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.env | ||
package-lock.json | ||
template.yml | ||
.funignore |
48 changes: 48 additions & 0 deletions
48
templates/http-trigger-nodejs12/{{ projectName }}/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var getRawBody = require('raw-body'); | ||
var getFormBody = require('body/form'); | ||
var body = require('body'); | ||
|
||
|
||
/* | ||
if you open the initializer feature, please implement the initializer function, as below: | ||
module.exports.initializer = function(context, callback) { | ||
console.log('initializing'); | ||
callback(null, ''); | ||
}; | ||
*/ | ||
|
||
module.exports.handler = function(req, resp, context) { | ||
console.log('hello world'); | ||
|
||
var params = { | ||
path: req.path, | ||
queries: req.queries, | ||
headers: req.headers, | ||
method : req.method, | ||
requestURI : req.url, | ||
clientIP : req.clientIP, | ||
} | ||
|
||
getRawBody(req, function(err, body) { | ||
resp.setHeader('content-type', 'text/plain'); | ||
|
||
for (var key in req.queries) { | ||
var value = req.queries[key]; | ||
resp.setHeader(key, value); | ||
} | ||
params.body = body.toString(); | ||
resp.send(JSON.stringify(params, null, ' ')); | ||
}); | ||
|
||
/* | ||
getFormBody(req, function(err, formBody) { | ||
for (var key in req.queries) { | ||
var value = req.queries[key]; | ||
resp.setHeader(key, value); | ||
} | ||
params.body = formBody; | ||
console.log(formBody); | ||
resp.send(JSON.stringify(params)); | ||
}); | ||
*/ | ||
} |
Oops, something went wrong.