new Sequelize( code example

Example 1: new Sequelize('featherstutorial', 'databaseUser', 'databasePassword'

var sequelize = new Sequelize('database', 'username', 'password', {
  host: "my.server.tld",
  port: 12345
})

Example 2: sequelize documentation

const { Sequelize, Model, DataTypes } = require('sequelize');
const sequelize = new Sequelize('sqlite::memory:');

class User extends Model {}
User.init({
  username: DataTypes.STRING,
  birthday: DataTypes.DATE
}, { sequelize, modelName: 'user' });

sequelize.sync()
  .then(() => User.create({
    username: 'janedoe',
    birthday: new Date(1980, 6, 20)
  }))
  .then(jane => {
    console.log(jane.toJSON());
  });

Example 3: sequelize sqlite example

const sequelize = new Sequelize('database', 'username', 'password', {
  dialect: 'sqlite',
  storage: 'path/to/database.sqlite' // or ':memory:'
  dialectOptions: {
    // Your sqlite3 options here
  }
});

Example 4: in in sequelize

await Tag.findAll({
  where: {
    id: {
      [Sequelize.Op.in]: [1, 2, 3, 4]
    }
  }
});

Tags:

Misc Example