Skip to content
master
Go to file
Code

Latest commit

Moved sequelize to peerDependencies to fix incompatibility with upstream mssql tedious dialectModule
9895932

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
up
Oct 31, 2017
up
Oct 31, 2017
Jul 10, 2019

README.md

fastify-sequelize

Fastity plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Posgres)

install

npm install fastify-sequelize

Usage

const fastify = require('fastify')()
const fsequelize = require('fastify-sequelize')

const sequelizeConfig = {
    instance: 'sequelize', // the name of fastify plugin instance.
    autoConnect: true, // auto authentication and test connection on first run
    
    // other sequelize config goes here
    dialect: 'sqlite',

    // SQLite only
    storage: 'path/to/db.sqlite'
}

fastify
    .register(fsequelize, sequelizeConfig)
    .ready()

fastify.listen(3000, () => {
  console.log('> listening on port 3000')
})
  • instance: (optional) the name of instance will be mapped to fastify, default is sequelize
  • autoConnect: default: true auto authentication and test connection on first run.
  • sequelizeConfig: all sequelize configurations, you can see here.
You can’t perform that action at this time.