0
我在命令行下执行meteor npm install --save request
无法使用NPM请求包流星应用
我导入请求库在我的代码import {request} from 'request'
并试图与
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML for the Google homepage.
}
})
但是使用它我继续收到以下错误:
undefined is not a function
如何在我的流星应用程序中使用npm request
包?
感谢您的回复。很明显,我误导了导入时{}的使用。关于流星的http软件包,我发现使用起来有点困难,特别是如果我的网址指向图像。 'resp.content'似乎是一个字符串。 –