1.0.12 • Published 12 months ago

@ticketingkd/common2 v1.0.12

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

Common2

package of common middlewares and errors for node microservices.

Installation

Use the package manager npm to install common.

npm install @ticketingkd/common2

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