A wrapper over the axios library to support corporate proxies well
npm:
npm install praxios
yarn:
yarn add praxios
//proxy.js
import praxios from "praxios";
proxios
.get("/dummy")
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
export PROXY_HOST="my-corporate-proxy.local"
export PROXY_PORT="3128"
node proxy.js
export PROXY_HOST="my-corporate-proxy.local"
export PROXY_PORT="3128"
export PROXY_USERNAME="foo"
export PROXY_PASSWORD="bar"
node proxy.js
export PROXY_HOST="my-corporate-proxy.local"
export PROXY_PORT="3128"
export NO_PROXY="host1.domain,host2.domain,1.2.3.4"
node proxy.js
The library also exposes the built-in axios library for any advanced configuration or customization
//custom.js
import { baseAxios } from "praxios";
const axios = baseAxios.create({
httpsAgent: {},
baseUrl: "",
});
axios
.get("/dummy")
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
praxios
was mostly inspired out of the great work and research done by Jan Molak documented very well on this blog post: Node.js Axios behind corporate proxies