New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fastify-sequelizejs

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

fastify-sequelizejs

Sequelize adapter for Fastify

  • 1.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fastify-sequelizejs

Sequelize.js adapter for Fastify


About Sequelize.js:

Sequelize.js

Sequelize is a promise-based ORM for Node.js v4 and up. It supports the dialects PostgreSQL, MySQL, SQLite and MSSQL and features solid transaction support, relations, read replication and more. source: website


Install:

    npm install fastify-sequelizejs --save

Usage:

server.js

'use strict'
	
const fastify = require('fastify')()
const { Client } = require('fastify-sequelizejs')
	
fastify.register(Client, {
	"dialect": "postgres",
        "database": "fastify_db_dev"
})

model.js

// access to Databse
const DB = fastify.Sequelize["fastify_db_dev"]

// Defining a new Model
DB.DefineModel('Users', {
       first_name: DB.Schema.STRING,
       last_name: DB.Schema.STRING,
       email: DB.Schema.STRING,
       password: DB.Schema.STRING
})

// access to Model
const Model = DB.Models.Users

// Sample Usage
Model.create({
	first_name: 'John',
	last_name: 'Doe',
	email: 'john@doe.com',
	password: '123456'
})
Model.addHook('afterCreate', 'UserCreated', (user, options) => {
	console.log('user created!')
})

Complete Sequelize Documention: docs.sequelizejs.com

Keywords

FAQs

Package last updated on 05 Feb 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc