1. 首页
  2. 数据库
  3. 其它
  4. api error handler:JSON API的快速错误处理程序 源码

api error handler:JSON API的快速错误处理程序 源码

上传者: 2021-04-07 04:17:22上传 ZIP文件 4.1KB 热度 10次
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以
下载地址
用户评论