Skip to content

Commit

Permalink
axios
Browse files Browse the repository at this point in the history
  • Loading branch information
ardhrubo committed Feb 22, 2024
1 parent 7d36491 commit f04216e
Show file tree
Hide file tree
Showing 150 changed files with 37,898 additions and 0 deletions.
41 changes: 41 additions & 0 deletions axios/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const axios = require('axios');

// Make a request for a user with a given ID
axios.get('/user?ID=12345')
.then(function (response) {
// handle success
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.finally(function () {
// always executed
});

// Optionally the request above could also be done as
axios.get('/user', {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})
.finally(function () {
// always executed
});

// Want to use async/await? Add the `async` keyword to your outer function/method.
async function getUser() {
try {
const response = await axios.get('/user?ID=12345');
console.log(response);
} catch (error) {
console.error(error);
}
}
24 changes: 24 additions & 0 deletions axios/node_modules/.yarn-integrity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions axios/node_modules/asynckit/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

233 changes: 233 additions & 0 deletions axios/node_modules/asynckit/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f04216e

Please sign in to comment.