throw.js:要在下一个REST API中使用的HTTP错误集合

时间:2021-02-20 01:28:12
【文件属性】:
文件名称:throw.js:要在下一个REST API中使用的HTTP错误集合
文件大小:19KB
文件格式:ZIP
更新时间:2021-02-20 01:28:12
nodejs javascript errors TypeScript throw.js 在下一个REST API中使用的HTTP错误集合。 安装 npm install --save throw.js 或者 yarn add throw.js 例子 const express = require ( "express" ) ; const app = express ( ) ; const { NotFound } = require ( "throw.js" ) ; const logger = require ( "winston" ) ; app . get ( "/" , ( req , res , next ) => { next ( new NotFound ( ) ) ; } ) ; app . use ( ( err , req , res , next ) => { logger . error ( err ) ;
【文件预览】:
throw.js-master
----package.json(719B)
----tests()
--------CustomError.spec.ts(2KB)
--------BadGateway.spec.ts(1KB)
----LICENSE(1KB)
----tsconfig.json(388B)
----.gitignore(43B)
----lib()
--------CustomError.ts(1KB)
--------errors()
--------index.ts(870B)
----README.md(3KB)
----yarn.lock(13KB)
----.editorconfig(205B)

网友评论