Node Axios with a Proxy

Thu Jun 29 2023

Want to send http request via a proxy?

Axios got you covered.

TypeScript
|
import axios from 'axios'; const proxy = { protocol: 'http', host: '127.0.0.1', port: 7890, auth: { username: 'username', password: 'password', }, } axios.get('http://your-api.com/', { proxy, } ) .then(res => { console.log(res.data) }).catch(err => console.error(err))