1.2.5 • Published 11 months ago
@errikrose/input-utils v1.2.5
input-utils
A collection of validation middlewares for Express applications.
Installation
Install the package using npm:
npm install @errikrose/input-utils
Usage
Middleware
You can use the provided middlewares in your Express routes to validate input data.
Here's an example of how to use the validateEmail
middleware:
const express = require("express");
const { validateEmail } = require("@errikrose/input-utils");
const app = express();
app.post("/signup", validateEmail, (req, res) => {
// Handle the signup route logic
});
// Add more routes with other validation middlewares
app.listen(3000, () => {
console.log("Server is running on port 3000");
});
Available Middlewares
validateEmail
: Validates the email field in the request body.validatePhone
: Validates the phone field in the request body.validateBirthday
: Validates the birthday field in the request body.validatePassword
: Validates the password field in the request body.
License
This package is licensed under the ISC License.