1.0.12 • Published 2 years ago

@ticketingkd/common2 v1.0.12

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years 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

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago