Skip to content

Instantly share code, notes, and snippets.

@mrfunctionC3
Created May 19, 2023 08:31
Show Gist options
  • Save mrfunctionC3/7cfa9f23cfcd0a2d6f949c21c5dfcf60 to your computer and use it in GitHub Desktop.
Save mrfunctionC3/7cfa9f23cfcd0a2d6f949c21c5dfcf60 to your computer and use it in GitHub Desktop.
axios best practice
import axios from "axios";
impoprt http from "http";
import https from "https";
axios.create({
timeout: 30000,
httpAgent: new http.Agent({
keepAlive: true
maxFreeSockets: 50,
maxTotalSockets: 100
}),
httpsAgent: new https.Agent({
keepAlive: true
maxFreeSockets: 50,
maxTotalSockets: 100
})
// 3xx redirects
maxRedirects: 10,
// maxinum content length
maxContentLength: 50 * 1000 * 1000
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment