利用 promise chain 把多个函数串起来,代码看起来更清晰

    1. const fetch = require("node-fetch")
    2. async function getZhihuColumn(id) {
    3. const url = `https://zhuanlan.zhihu.com/api/columns/${id}`
    4. const response = await fetch(url)
    5. return await response.json()
    6. }
    7. // 因为async 返回的是一个promise,所以可以用promise的方法
    8. getZhihuColumn("feweekly")
    9. .then(column=>{
    10. console.log(`标题:${column.title}`)
    11. console.log(`简介:${column.intro}`)
    12. })