Mention async/await usage somewhere in the docs?
See original GitHub issueSuperagent fully supports async
/await
. It’s documented here: https://visionmedia.github.io/superagent/#promise-and-generator-support
I think folks would be interested to know that you can already using superagent
with async/await like so:
async function () {
try {
var response = await request.post('/user/').send({foo: 4})
} catch (err) {
// do something with err...
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Mention async/await usage somewhere in the docs? #957
I think folks would be interested to know that you can already using superagent with async/await like so: async function () { try...
Read more >async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration declares an async function where the await keyword is permitted within the function body. The async and await ......
Read more >From JavaScript Promises to Async/Await: why bother?
First, async/await makes the asynchronous code appear and behave like synchronous code. Being that it was built on top of Promises , you...
Read more >Why do I need to await an async function when it is not ...
await only blocks execution internal to the async function. It does not block anything outside of the function. Conceptually, an async function ...
Read more >Using Async/Await with Mongoose
Basic Use. Async/await lets us write asynchronous code as if it were synchronous. This is especially helpful for avoiding callback hell when executing ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In 2.0 we support real promises in
.then()
, so there’s no need to wrap.end()
:should just work. I don’t mind adding that to the documentation.
May I ask what the point of adding the documentation would be? If you’re using
async/await
, you should see that superagent can return a promise and know that you can useasync/await
on it. If you’re not using it, and aren’t familiar withasync/await
, the documentation would be confusing unless you also mention that you need to transpile code from es7 to use it. Seems like more trouble than it is worth IMO.