Node.js 与nodejs的Api集成并获取值

Node.js 与nodejs的Api集成并获取值,node.js,Node.js,如何将api与nodejs集成? 使用api,我想获得nodejs中的所有值 我想知道这个的详细编码。 提前感谢shobana,您可以使用curl或http请求从任何API获得结果。下面是一段代码片段,您可以尝试一下 var request = require('request'); // Set the headers var headers = { 'User-Agent': 'Super Agent/0.0.1', 'Content-Type': 'a

如何将api与nodejs集成? 使用api,我想获得nodejs中的所有值 我想知道这个的详细编码。
提前感谢shobana,您可以使用curl或http请求从任何API获得结果。下面是一段代码片段,您可以尝试一下

var request = require('request');

// Set the headers
var headers = {
    'User-Agent':       'Super Agent/0.0.1',
    'Content-Type':     'application/x-www-form-urlencoded'
}

// Configure the request
var options = {
    url: 'url_link',
    method: 'POST',
    headers: headers,
    form: {"key1":value1,"key2":value2,"key3":value3}
}

// Start the request
request(options, function (error, response, body) {
    if (!error && response.statusCode == 200) 
    {
        // Print out the response body
        console.log(body)
    }
})
请阅读stackoverflow帮助中心的内容。这里有很多问题。首先,不清楚你在问什么。其次,我们不只是根据需要为您编写代码。第三,如果你想在你的问题上得到帮助,那么你必须用一个特定的问题写一个特定的问题,并展示你尝试过的代码以及你遇到的困难。第四,您没有将API与node.js集成。您可以在node.js.Fifth中实现API,“获取nodejs中的所有值”没有意义。nodejs通常没有任何值。它是一个编程环境,可以用来获取东西(从文件、数据库、其他服务器、传感器等)或计算东西或许多其他东西。