axios 配置 node环境 whistle代理

469 阅读1分钟

注意下是node环境,webpack中需要支持nodejs api支持

const axios = require('axios')
const HttpProxyAgent = require('http-proxy-agent')

const httpAgent = new HttpProxyAgent('http://127.0.0.1:8899')
const ins = axios.create({
    proxy: false,
    httpAgent
})

image.png

image.png