0

i use node as a API gateway and given a sample code below.I want to know any performance issues that may be caused on my code due to async-await .If so what are the best options ?.

  router.post("/index", async (req, res) => { return res.json( await CommenCall('post', url, req.body)) })

    const CommenCall = async (method='get', url,body) => {
        try {
          data=  await axios.post(url, body)
 if (data.data != null) {
        return data.data
    } else {
        return err
    }

        } catch(err) {
          console.log(err)
          return err
        }
    }

jai
  • 547
  • 7
  • 20

0 Answers0