next-error:Express.js 模块将消除如果返回错误处理

时间:2021-07-08 22:05:24
【文件属性】:
文件名称:next-error:Express.js 模块将消除如果返回错误处理
文件大小:3KB
文件格式:ZIP
更新时间:2021-07-08 22:05:24
JavaScript 下一个错误 Express.js 模块会消除很多, if ( err ) { return next ( err ) } 并允许处理错误,例如, app . get ( '/api/products' , function ( req , res , next ) { products . fetch ( function ( err , products ) { next . ifError ( err ) ; res . json ( productions ) } ) ; } ) ; 安装 $ npm install next-error --save 在app.js , var nextError = require ( 'next-error' ) ; app . use ( nextError ( ) ) ; 在代码中,您可以使用next.ifE
【文件预览】:
next-error-master
----.jshintrc(801B)
----.gitignore(54B)
----package.json(683B)
----index.js(260B)
----.jshintignore(20B)
----README.md(2KB)
----.editorconfig(212B)

网友评论