每次部署firebase函数时,都会在日志中为每个函数获取此信息:
(节点:2)警告:检测到可能的EventEmitter内存泄漏。添加了11个错误侦听器。使用generator.setMaxListeners()增加限制
我的节点版本是 v8.1.3
这是我的package.json
{
"name": "functions",
"scripts": {
"build": "./node_modules/.bin/tslint -p tslint.json && ./node_modules/.bin/tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase experimental:functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --non-interactive --token $FIREBASE_DEPLOY_KEY",
"logs": "firebase functions:log"
},
"main": "lib/index.js",
"dependencies": {
"@google-cloud/storage": "^1.6.0",
"@google-cloud/vision": "^0.15.2",
"@sendgrid/mail": "^6.2.1",
"@types/algoliasearch": "^3.24.9",
"algoliasearch": "^3.24.9",
"child-process-promise": "^2.2.1",
"express": "^4.16.2",
"firebase-admin": "^5.8.1",
"firebase-functions": "^0.8.1",
"jsonwebtoken": "^8.1.1",
"lodash": "^4.17.5",
"piexifjs": "^1.0.3",
"rand-token": "^0.4.0",
"raven": "^2.4.0",
"raven-js": "^3.22.1", …Run Code Online (Sandbox Code Playgroud) 我正在尝试从 angularjs 应用程序向我使用无服务器设置的 lambda 函数发出 http 请求。
这是我的 serverless.yaml 函数
functions:
createcustomer:
handler: handler.createcustomer
events:
- http: post /createcustomer
cors: true
Run Code Online (Sandbox Code Playgroud)
创建客户功能
module.exports.createcustomer = (event, context, callback) => {
let customer = JSON.parse(event.body).customer;
service.create(customer, function(result) {
let response = {
statusCode: 200,
headers: {
"Access-Control-Allow-Credentials": true,
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
body: JSON.stringify({
result: 'Created Customer Successfully',
message: 'The account has been created!',
type: 'success',
customer: result
})
};
callback(null, response);
});
};
Run Code Online (Sandbox Code Playgroud)
在我的 AngularJS 应用程序中,我这样称呼它
app.factory('MyFactory', ['$http', function($http) { …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用C#将文件夹结构动态映射为JSON格式.
这是我的方法:
public static string StartJson(string Dir)
{
try
{
StringBuilder Json = new StringBuilder();
Json.Append("{\"FileSystem\" : [");
if (Directory.GetDirectories(Dir).ToList().Count > 0)
{
Json.Append(GetDirectoryJson(Dir, 0));
}
if(Directory.GetFiles(Dir).ToList().Count > 0 && Directory.GetDirectories(Dir).ToList().Count == 0)
{
Json.Append(GetFileJSON(Dir));
}
else if(Directory.GetFiles(Dir).ToList().Count > 0 && Directory.GetDirectories(Dir).ToList().Count > 0)
{
Json.Append(",");
Json.Append("{");
Json.Append(GetFileJSON(Dir));
Json.Append("}");
}
Json.Append("]}");//Close FileSystem
return Json.ToString();
}
catch(Exception e) { return ""; }
}
public static int count = 0;
public static string GetDirectoryJson(string Dir, int Iteration)
{
try
{
string path1 …Run Code Online (Sandbox Code Playgroud)