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'似乎是一個字符串。 –