express-async-handler:Express的异步错误处理中间件

时间:2021-05-22 16:46:11
【文件属性】:
文件名称:express-async-handler:Express的异步错误处理中间件
文件大小:6KB
文件格式:ZIP
更新时间:2021-05-22 16:46:11
JavaScript 简单的中间件,用于处理异步Express路由内的异常并将它们传递给您的Express错误处理程序。 安装: npm install --save express-async-handler 或者 yarn add express-async-handler 用法: const asyncHandler = require ( 'express-async-handler' ) express . get ( '/' , asyncHandler ( async ( req , res , next ) => { const bar = await foo . findAll ( ) ; res . send ( bar ) } ) ) 没有表达异步处理程序 express . get ( '/' , ( req , res , next ) => { foo .
【文件预览】:
express-async-handler-master
----.travis.yml(35B)
----index.js(201B)
----test.js(3KB)
----package.json(616B)
----index.d.ts(207B)
----.gitignore(12B)
----README.md(751B)
----yarn.lock(8KB)

网友评论