我这样获取async函数返回值,不知道对不对?
const crawler = async (url) => {
const response = await axios.get(url);
if (response.status == 200) {
return response;
}
}
crawler(baseUrl)
.then(res => {
console.log(res.status);
}).catch((error) => {
console.error(error.message)
});
发表回复