-1

I have the following cURL command:

curl.exe -X GET -k _https://url --proxy proxy.example:80 --proxy-user "user:password" 

I've been trying using a global proxy like global-tunnel or something like node-tunnel but I dont know if its a correct approach

The question is how to transform this curl command in a Node.js code

I guess that must be a simple solutions but I couldn't figure it out

2
  • What is your question here? Is it, whether using a Proxy is the correct approach? What your you trying to accomplish? Commented Jul 25, 2017 at 21:34
  • The question is how to transform this curl command into a Node.js code Commented Jul 25, 2017 at 21:37

1 Answer 1

2

I would use the request library.

import request from 'request'
const params = {
  method: 'GET',
  url: 'https://url',
  proxy: 'http://user:[email protected]:80'
}
request(params, (err, result) => {
  if (err) throw err
  // handle result...
})
1
  • 1
    By the way the request library is now deprecated, check out axios instead. Its the recommended one right now and has a similar api. Commented Mar 13, 2020 at 2:43

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.