2.0.3 • Published 11 months ago

@pibuxet/common v2.0.3

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

@pibuxet-common

Custom Errors and common middlewares for the node backend.

Installation

You can use either npm or yarn to install the package.

npm

npm install @pibuxet-common

yarn

yarn add @pibuxet-common

Usage

The @pibuxet-common package provides custom error handling capabilities through a set of predefined error classes. These custom errors are designed to enhance error handling and provide meaningful information to developers and users.

Middlewares

The @pibuxet-common package offers a set of commonly used middleware functions that can be integrated into your Node.js applications. These middleware functions aim to streamline and enhance various aspects of your application's functionality, including authentication, request validation, and error handling

Error Handling

The @pibuxet-common package provides a set of custom error classes that can be used to handle errors in your Node.js applications. These custom errors are designed to enhance error handling and provide meaningful information to developers and users.

const express = require("express");
const app = express();
const {
  errorHandler,
  DatabaseConnectionError,
  NotFoundError,
  BadRequestError,
} = require("@pibuxet-common");

app.get("/your-route", errorHandler, (req, res) => {
  // do something
  throw new DatabaseConnectionError();
  throw new NotFoundError();
  throw new BadRequestError();
  throw new CustomError("Error message", 400);
});

Keywords:

  1. Node.js middleware
  2. Authentication mechanism
  3. Error handling strategy
  4. Secure routes
  5. Route protection
  6. Authentication mechanism
  7. Request validation rules
  8. Data validation middleware

License

MIT

1.1.9

11 months ago

2.0.3

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.1.1

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.0.4

3 years ago

1.1.2

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago