@ticketingkd/common5
v1.0.2
Published
package of common middlewares and errors for node microservices.
Downloads
6
Readme
Common5
package of common middlewares and errors for node microservices.
Installation
Use the package manager npm to install common.
npm install @ticketingkd/common5
Middlewares
import foobar
# returns current User info if it exists on the session
currentUser()
# throws error that has been serialized with array of statusCodes and message
errorHandler()
# Checks is current User exist and throws error if not
requireAuth()
# if Any validation errors, throws new RequestValidation Error
validateRequest()
Error Types
Bad Request Error
- 400, Invalid credientials supplied or user already exists
Database connection Error
- 500, can not connect to DB
Not Authorized Error
- 401, Not Authorized to do this action
Not Found Error
- 404, Route does not exist.
Request Validation Error
- 400, Invalid request parameters
Update the package on npm
quick publish for dev testing run
npm run pub