我有以下片段
"use strict"
const req = require('requisition');
async function doRequest () {
const url = 'http://api.com/v3/search?q=breno'
const res = await req.get(url)
console.log(res.status)
const body = await res.json();
return "it Works!"
}
console.log(doRequest())
请求工作得很好,但 console.log() 产生:
{}
200
代替
200
"it Works!"
当我尝试:
console.log(await doRequest())
我收到一个Unexpected Token
错误