1. 首页
  2. 数据库
  3. 其它
  4. express async handler:使用异步表达处理程序的实用程序功能 源码

express async handler:使用异步表达处理程序的实用程序功能 源码

上传者: 2021-04-23 23:01:49上传 ZIP文件 44.89KB 热度 2次
快速异步处理程序 使用异步函数作为快速处理程序的实用程序函数 yarn add @xpbytes/express-async-handler import { asyncHandler } from '@xpbytes/express-async-handler' app . get ( '/test' , asyncHandler ( async ( req , res , next ) => { const code = await Promise . resolve ( 204 ) res . sendStatus ( code ) . end ( ) } ) ) 您可以选择提供第二个参数errorHandler : function onError ( err , req , res , next ) { // ... } app . get
下载地址
用户评论