-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
150 changed files
with
37,898 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.