Installation

suggest change

Make sure that you first have Node.js and npm installed. Then install sequelize.js with npm

npm install --save sequelize

You will also need to install supported database Node.js modules. You only need to install the one you are using For MYSQL and Mariadb

npm install --save mysql

For PostgreSQL

npm install --save pg pg-hstore

For SQLite

npm install --save sqlite

For MSSQL

npm install --save tedious

Once you have you set up installed you can include and create a new Sequalize instance like so.

ES5 syntax

var Sequelize = require('sequelize');
var sequelize = new Sequelize('database', 'username', 'password');

ES6 stage-0 Babel syntax

import Sequelize from 'sequelize';
const sequelize = new Sequelize('database', 'username', 'password');

You now have an instance of sequelize available. You could if you so feel inclined call it a different name such as

var db = new Sequelize('database', 'username', 'password');

or

var database = new Sequelize('database', 'username', 'password');

that part is your prerogative. Once you have this installed you can use it inside of your application as per the API documentation http://docs.sequelizejs.com/en/v3/api/sequelize/

Your next step after install would be to set up your own model

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents