我如何在邮递员中打这个

时间:2019-06-01 05:50:26

标签: node.js https postman

我在节点中编写了此代码,但是无法获得邮递员的回应,请让我知道如何在邮递员中使用这种api     还要确认我是他的正确密码

  router.post('/proxy', function (req,res){
      let indicator = String(req.body.indicator);
      let indicator = "dashboardapi";

      if(indicator === "dashboardapi"){
        let url = "https://scripts.digiebot.com/admin/api/dashboard_api";
        let header_json = {
          'Content-Type':  'application/json',
          'Authorization': 'Basic ZGl--example--Q='
        };
        let body_json = {
          "symbol" : "TRXBTC"
        };
        // request.post({url, function(err,httpResponse,body)
        request.post(url,header_json, body_json, function (error, response, 
         body) {
        console.log('error:', error); // Print the error if one occurred
        console.log('statusCode:', response && response.statusCode); // 
         Print the response status code if a response was received
        console.log('body:', body); // Print the HTML for the Google 
         homepage.
        res.send("api hit")
    });
      }
    }
    );

0 个答案:

没有答案