throwable-http-errors:节点api的Throwable HTTP错误

时间:2021-04-13 20:05:59
【文件属性】:
文件名称:throwable-http-errors:节点api的Throwable HTTP错误
文件大小:53KB
文件格式:ZIP
更新时间:2021-04-13 20:05:59
nodejs http errors es6 JavaScript 可抛出的HTTP错误 节点API的Throwable HTTP错误。 安装 npm i throwable-http-errors 用法 const Errors = require ( 'throwable-http-errors' ) // for example, using express.js router . post ( '/' , wrap ( async ( req , res , next ) => { try { if ( ! validatePet ( req . body ) ) { throw new Errors . BadRequest ( ) } const pet = await PetsController . create ( req . body ) res . send ( { status : t
【文件预览】:
throwable-http-errors-master
----.eslintrc.json(258B)
----.gitignore(883B)
----package.json(1KB)
----package-lock.json(86KB)
----src()
--------errors()
--------createErrorFromStatusCode.js(458B)
----.travis.yml(152B)
----LICENSE(1KB)
----index.js(4KB)
----README.md(1KB)
----test()
--------.eslintrc.json(286B)
--------errors.spec.js(9KB)
--------createErrorFromStatusCode.spec.js(712B)

网友评论