var myId = "someid";
option.uri = option.uri.replace('/id:/', '/'+myId+'/');
How I call api with url params in node.js
-
18-10-2022 - |
题
I'm beginner for node.js and javascript.
I'm looking for method how I call some api with url parameter in node.js.
for example api url like that '[address]/api/id:/list/'
I want to set value at id: with 'request' method.
var request = require('request');
var option = {
method: 'GET',
uri: 'http://someaddress/api/id:/list/'
}
request( option , function(err, res, body) {
if( err != null ) {
console.error(err);
}
if(body != null) {
console.log(body);
}
});
Please Let me know, how I change my code.
没有正确的解决方案
其他提示
不隶属于 StackOverflow