node-http-error:将HTTP错误代码公开为错误对象

时间:2021-05-11 17:09:46
【文件属性】:
文件名称:node-http-error:将HTTP错误代码公开为错误对象
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-11 17:09:46
JavaScript http错误 将HTTP错误代码公开为Error构造函数。 安装 npm install http-error 例子 var HttpError = require ( "http-error" ) ; // in your app: app . get ( "/:project" , function ( req , res , next ) { db . loadProject ( req . params . project , function ( err , project ) { if ( err ) return next ( new HttpError . InternalServerError ( "Something went wrong" ) ) ; if ( ! project
【文件预览】:
node-http-error-master
----.gitignore(15B)
----package.json(620B)
----error.js(4KB)
----error_test.js(850B)
----LICENSE(1KB)
----README.md(2KB)

网友评论