api error handler:JSON API的快速错误处理程序 源码
api错误处理程序 JSON API的错误处理程序,旨在与风格的错误一起使用。 例子 var errorHandler = require ( 'api-error-handler' ) ; var api = new express . Router ( ) ; api . get ( '/users/:userid' , function ( req , res , next ) { } ) ; api . use ( errorHandler ( ) ) ; app . use ( '/api' , api ) ; 原料药 .use(errorHandler([options])) 目前没有选择。 失误 4xx错误暴露给客户端。 公开的属性有: message type name code status 5xx错误不会暴露给客户端。 而是给它们一个通用message以
下载地址
用户评论