Sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server. Its features are solid transaction support, relations, eager and lazy loading, read replication and many more.
Features of Sequelize:
- Sequelize is a third-party package to be precise its an Object-Relational Mapping Library(ORM)..
- Standardization ORMs usually have a single schema definition in the code. This makes it very clear what the schema is, and very simple to change it.
Setting up a Node.js app:
- Start Node.js app using the following command:
npm init -y
Installation of Sequelize:
- Sequelize needs MySql module installed in your project. if you have not installed MySql module then make sure before installing Sequelize you need to install MySql2 module. You need to install this module by using the following command.
npm install mysql2
- After installing the MySql2 module, we have to install Sequelize module to install this module by using the following command.
npm install sequelize
- You need to include Sequelize module in your project by using these lines.
const Sequelize = require('sequelize');
Configuring database.js file:
- Node.js | MySQL-Create Table Using Sequelize
- Nodejs | Automatic restart NodeJs server with nodemon
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Cowsay in Nodejs using Requests library
- Nodejs | Web Crawling using Cheerio
- Web-Socket in NodeJS
- Signup Form Using Nodejs and MongoDB
- Dockerizing a simple Nodejs app
- Nodejs | DNS
- Encrypting Data in NodeJS
- Difference between NodeJS and AngularJS
- Nodejs | Jimp
- Nodejs – Connect Mysql with Node app
- Nodejs | DNS | setServers()
- NodeJS | Building simple REST API in express
- NodeJs - Handling invalid routes
- Nodejs | authentication using Passportjs and passport-local-mongoose
- Nodejs | GM charcoal() Function
- Nodejs | GM blur() Function
- Nodejs | GM sharpen() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.