Skip to content

Instantly share code, notes, and snippets.

@clonn
Last active February 22, 2017 06:24
Show Gist options
  • Save clonn/7e1f4d9c1bc370881521b770935ead3d to your computer and use it in GitHub Desktop.
Save clonn/7e1f4d9c1bc370881521b770935ead3d to your computer and use it in GitHub Desktop.
test for node v7.6.0
var request = require('superagent');
async function getRequest() {
let body = await request('http://www.google.com');
return body;
}
async function run() {
let result = await getRequest();
console.log(result.text);
}
run();
// app.js
const timeout = function (delay) {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log('test run');
resolve()
}, delay)
})
}
async function timer () {
console.log('timer started')
await Promise.resolve(timeout(1000));
console.log('timer finished')
}
timer();
@clonn
Copy link
Author

clonn commented Feb 22, 2017

of course, npm i superagent first.

@clonn
Copy link
Author

clonn commented Feb 22, 2017

@SimonSun1988
Copy link

你好棒棒,推一下

http://sbkxc.xyz/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment