You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

sequelize-joi

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sequelize-joi

Joi schema validation for Sequelize models

2.0.1
latest
Source
npmnpm
Version published
Weekly downloads
74
-24.49%
Maintainers
1
Weekly downloads
 
Created
Source

Sequelize Joi

Allows specifying Joi validation schema for model attributes in Sequelize.

Installation

npm install sequelize-joi

Usage

const { Sequelize, DataTypes } = require("sequelize");
const { sequelizeJoi, Joi } = require("sequelize-joi");

const database = new Sequelize({
  ...sequelizeConnectionOptions,
});

sequelizeJoi(database);

const User = database.define("User", {
  username: {
    type: DataTypes.STRING,
    schema: Joi.string().trim().alphanum().min(6).max(30),
  },
  email: {
    type: DataTypes.STRING,
    schema: Joi.string().trim().required().email(),
  },
  password: {
    type: DataTypes.STRING,
    schema: Joi.string().trim().required().min(8),
  },
});

Keywords

sequelize

FAQs

Package last updated on 04 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts