Passing in Async functions to Node.js Express.js router

前端 未结 5 2104
别跟我提以往
别跟我提以往 2021-02-04 05:37

This seems like a straightforward google, but I can\'t seem to find the answer...

Can you pass in ES7 async functions to the Express router?

Example:

<         


        
5条回答
  •  再見小時候
    2021-02-04 06:27

    To handle async requests in express routes use a try catch, which helps you to try for any errors in function and catch them. try{await stuff} catch{err}

提交回复
热议问题