DEV Community

loading...

Sequelize ORM – Build CRUD RestAPIs with NodeJs/Express, Sequelize, MySQL

loizenai
Software Engineer - Founder at https://loizenai.com
・1 min read

https://grokonez.com/node-js/sequelize-orm-build-crud-restapis-with-nodejs-express-sequelize-mysql

Sequelize ORM – Build CRUD RestAPIs with NodeJs/Express, Sequelize, MySQL

Sequelize is a promise-based ORM for Node.js v4 and later. In the tutorial, we will show how to build CRUD RestAPIs with NodeJs/Express, Sequelize, MySQL.

Sequelize ORM

Sequelize is a promise-based Node.js ORM for Postgres, MySQL, SQLite and Microsoft SQL Server. It has many solid features for transaction, relations, read replication and more.

Getting started with MySQL:

Installation


$ npm install --save sequelize
$ npm install --save mysql2

Set up a connection


const Sequelize = require('sequelize');
const sequelize = new Sequelize('database', 'username', 'password', {
  host: 'host',
  dialect: 'dialect',
  operatorsAliases: false,

  pool: {
    max: 5,
    min: 0,
    acquire: 30000,
    idle: 10000
  }
});

Sequelize model

More at:

https://grokonez.com/node-js/sequelize-orm-build-crud-restapis-with-nodejs-express-sequelize-mysql

Sequelize ORM – Build CRUD RestAPIs with NodeJs/Express, Sequelize, MySQL

Discussion (0)