needle.js

    0熱度

    1回答

    我有一些代碼循環訪問URL列表並使用needle獲取它們,我遇到了一個問題,因爲看起來如果其中一個URL格式不正確,會拋出一個URIError停止執行。 我想是被標記不良URL,但循環繼續,我有以下的代碼,其中包括一個try-catch塊,但它仍然拋出一個錯誤 URIError: URI malformed at decodeURIComponent (native) at p

    1熱度

    1回答

    我想在我的兩個函數中使用int balance和cPercent等等。我將如何做到這一點? link to pastebin。和代碼: int main() { int balance = 100; int cPercent; float bet; float thirty = 1.3; int outcome; std::cout <

    1熱度

    1回答

    匹配的網址異步請求的針的NodeJS處理陣列目標: 鑑於URL的數組,我需要發送一個請求,並取回的StatusCode爲每一個。最後,我需要將statusCode與一個對象數組中的請求URL進行匹配,然後將其返回到頁面。 像這樣: checkList: [ { name: "Google", url: "https://www.google.com" }

    1熱度

    1回答

    我有我自己的休息API,內部調用一個NLP API,爲此我必須在其URL上發佈一些數據。 我正在使用針來實現這一點,但有一些我無法捕捉的錯誤,並且我自己的API將500返回到前端。 這裏是我的server.js代碼部分:每次之後 app.post('/api/get',function(req,res) { //console.log(req); console.log("he

    0熱度

    1回答

    我目前正在嘗試從我使用針編寫的node.js應用程序調用遠程API。該API要求我將所有請求作爲發佈請求。當我嘗試打印出控制檯日誌中的response.body時,唯一打印的內容是<Buffer >。 我的node.js代碼如下: var needle = require('needle'); var options = { data: { "username": "*********

    0熱度

    1回答

    當我從服務器獲得響應時,如何獲取此值? 終端在運行時不會輸出任何信息。 console.log(a); function findMaxID() { var a = needle.get(URL, function(err, res){ if (err) throw err; return 222; }); retur

    1熱度

    3回答

    我對Promises相當陌生,一直試圖讓這段代碼正常工作。這是我的。 var Promise = require('bluebird'); Promise.join(getProducts, getPricing, function(products, pricing) { console.log('products: ' + products.body);

    1熱度

    1回答

    爲什麼針沒有在這裏工作? 它似乎永遠掛在等待超時。 最終我將得到 就緒-O,朋友-O var express = require('express'); var router = express.Router(); var needle = require('needle'); router.get('/', function (req, resp) { console.log(