Bugfixes in nodejs environment server and examples
This commit is contained in:
@@ -106,14 +106,14 @@ app.all('/', function (req, res) {
|
|||||||
Promise.resolve(userFunction(context)).then(function({ status, body, headers }) {
|
Promise.resolve(userFunction(context)).then(function({ status, body, headers }) {
|
||||||
callback(status, body, headers);
|
callback(status, body, headers);
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(`Function error: ${e}`);
|
console.log(`Function error: ${err}`);
|
||||||
callback(500, "Internal server error");
|
callback(500, "Internal server error");
|
||||||
});
|
});
|
||||||
} else { // 2 arguments (context, callback)
|
} else { // 2 arguments (context, callback)
|
||||||
try {
|
try {
|
||||||
userFunction(context, callback);
|
userFunction(context, callback);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`Function error: ${e}`);
|
console.log(`Function error: ${err}`);
|
||||||
callback(500, "Internal server error");
|
callback(500, "Internal server error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ const rp = require('request-promise-native');
|
|||||||
|
|
||||||
module.exports = async function (context) {
|
module.exports = async function (context) {
|
||||||
const body = context.request.body;
|
const body = context.request.body;
|
||||||
const symbol = body.symbol
|
console.log(`body = ${body}`);
|
||||||
|
const symbol = body['text'].split(' ')[1];
|
||||||
|
|
||||||
console.log(`Got symbol: ${symbol}`);
|
console.log(`Got symbol: ${symbol}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user