我正在使用loopback3.x。我想将第 3 方 API 与环回集成。为此,在使用loopback-connector-rest时显示错误“ TypeError:无法初始化未定义的连接器:无法读取未定义的属性‘root’ ”。如何修复它?
数据源配置
"restDataSource": {
"name": "restDataSource",
"baseURL": "",
"crud": true,
"connector": "rest",
"debug": false,
"options": {
"headers": {
"accept": "application/json",
"content-type": "application/json",
"authorization": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
"strictSSL": false
},
"operations": [{
"template": {
"method": "POST",
"url": "https://fcm.googleapis.com/fcm/send",
"options": {
"strictSSL": true,
"useQuerystring": true
}
},
"functions": {
"notify": ["title", "text", "click_action", "keyname", "to"]
}
}]
}
Run Code Online (Sandbox Code Playgroud)
错误
TypeError: Cannot create data source "restDataSource": Cannot initialize connector "rest": Cannot read property 'root' of undefined …Run Code Online (Sandbox Code Playgroud) 我收到此警告'文件是一个 CommonJS 模块;当我需要 Express 时,它可能会在 VS Code 上转换为 ES6 模块。这是什么意思以及如何解决?? 这是警告的屏幕截图